RDML OTHER file – allow long field names with a length greater than 256 characters

Date: 17 May 2006
Product/Release: LANSA for iSeries
Abstract: Allow use of > 256 character fields which also have long field names
Submitted By: LANSA Technical Support

LANSA for the iSeries (RDML) is capable of handling fields greater than 256 characters which also have long field names in OTHER files loaded into LANSA.

These are steps and conditions that need to be followed to allow access to these fields once the file is defined to LANSA.

Environment Considerations:

  • The operating system must be at Release V4R1M0 or above of the operating system.
  • The LANSA I/O modules need to be compiled using RPG/IV.
  • Specify the option *RPGIV in the data area DC@OSVEROP to indicate that each program is to be compiled using RPG/IV code, then bound as a single module ILE type program.

File Considerations:

The external file definition is loaded into LANSA, and although the field itself will not be loaded into the LANSA definition as it is greater than 256 characters and also has a long field name, virtual fields can be created to allow the manipulation of the field and it's data using Virtual Field Derivation code.

The following approach can be applied for fields up to 9999 characters long and even for any non-supported data types.

This example uses 2 fields.

  1. Create a file FILEA into LANSA as maintained by OTHER and load its definition from the external library. It has a 400 character long field called FIELDA400 (i.e its name in the DDS).
* ************** Beginning of data ***************************
0001.00 A          R AFILER
0002.00 A             KEY1 5
0003.00 A             FIELDA400    400A
0004.00 A          K KEY1
* ***************** End of data *****************************
  1. Take Option 29 to Load the file definition into LANSA. On LOAD, the field FIELDA400 will be omitted:
DC@P201401 File Load/Reload Messages
The following message(s) resulted from attempt to load or re-load this file. Please ensure that you review ALL the messages before attempting to make this file definition operational. For more information about a message place the screen cursor on the message and press HELP. Do NOT attempt to use this file if one or more fatal messages were issued.
2 records added to member DC@WKFFD in file DC@WKFFD in QTEMP.
1 records added to member DC@WKKEY in file DC@WKKEY in QTEMP.
1 records added to member DC@WKDBR in file DC@WKDBR in QTEMP.
Definition of field FIELDA400 not found in the data dictionary
WARNING - field FIELDA400 omitted from definition of file - use HELP <<----
Definition of physical file FILEA from SPLIB successfully loaded
1 Warning messages issued during load of file FILEA from SPLIB
0 Fatal messages issued during load of file FILEA from SPLIB
  1. Make the file operational (i.e. create the I/O module) generating the I/O Module source listing. In the generated RPG code, you will see that LANSA failed to convert the FIELDA400 field into an internal LANSA field name. In the I specs, the original field name (i.e. FIELDA400, brought across from the DDS) is preserved in the generated RPG code and it is located in the same buffer positions (ie positions from and to in the record format) as defined in the DDS.
346 I KEY1 @F0001
* RPG record format . . . . : BLOCKR@R *
* External format . . . . . . : AFILER : IKLIB/FILEA *
347=I                             A    1     5  @F0001 
348=I                             A    6  405  FIELDA400   
350 I               KEY1                         @F0001 

This fact allows the use of the original field name as an input field (to be worked with) for any virtual field definition. Therefore, any number of virtual fields can be created to be derived from and to this field name. (i.e. FIELDA400).

  1. Create two fields in LANSA.
    E.g. FLDV1 and FLDV2. Both alphanumeric with a length of 200 characters.
  1. Define these virtual fields into the file loaded in step 1. (Option 23)
DC@P201601 Display Virtual Fields in File Definition


Edit virtual field derivation code . . . . . .      YES, NO

Sequence Name                    Description PJF 
                                           PJF's before virtuals derived on input 
                                           Virtual Fields derived after input 
                                           PJF's after virtuals derived on input 
                                           Virtual Fields derived before output 
                                           Undefined Virtual Fields 
         60   FLDVR1                   FLDV1 U 
         70   FLDVR2                   FLDV2 U 
  1. Specify YES in Edit virtual field derivation code . . . . . .   YES   YES, NO        
  1. Select "Data structure specifications" and type in :
*************** Beginning of data ****************************
0001.00      I**ILEFIELDA400   DS            400
0002.00      I**ILEFLVIR1                      1 200
0003.00      I**ILEFLVIR2                   201 400
****************** End of data ******************************

This will create a data structure for the real field FIELDA400 with subfields FLVIR1 and FLVIR2 which will be used for the manipulation of the data within the virtual code.

  1. Select "Calculations after input from file" and type in :
*************** Beginning of data ******************************
0002.00 C**ILE                       MOVEL     FLVIR1        FLDVR1
0003.00 C**ILE                       MOVEL     FLVIR2        FLDVR2
****************** End of data ********************************

Note: The comment lines with the VC_USING are necessary for each virtual field (between parentheses) and must not be omitted.

  1. Select "Calculations before output to file" and type in :
*************** Beginning of data *******************************
0002.00 C**ILE                        MOVEL     FLDVR1        FLVIR1
0003.00 C**ILE                        MOVEL     FLDVR2        FLVIR2
****************** End of data *********************************
  1. After the virtual derivation code has been inserted and the changes to the file committed, compile the file, keeping the compilation source listing for any compilation errors.

Within LANSA functions, the virtual fields, FLDVR1 and FLDVR2 are now used to access the data for the real field FIELDA400.

Virtual Logic Code Warnings:

RPG/IV – The syntax format must be in RPG/IV and each line of code must have the text **ILE after the form type. This will compile the virtual logic as RPG/IV instead of the RPG/III default. (As per examples)

VC_USING – All LANSA defined fields for the file which are used in the virtual code must be specified in the VC_USING command.