You are in: RPG Cafe > Full ALIAS support and easier result data structure
Short URL: http://ibm.biz/rpg_full_alias_and_easier_ds_io
RPG Cafe: I/O enhancements
Full ALIAS support and easier result data structure for IO
- ILE RPG compiler: SI54502
- ILE RPG compiler: SI54155
- ILE RPG compiler TGTLRS(V7R1M0): SI54521
Documentation in the IBM Knowledge Center
The ILE RPG Reference for 7.2 is updated with information about the PCML enhancements. Start at the "What's New Since 7.2".
Note: The 7.1 IBM Knowledge Center is not updated, but the information about these enhancements in the 7.2 IBM Knowledge Center also applies to 7.1.
- 7.2 Reference: What's new since 7.2: https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/rpgrelv7r2post.htm
Extended ALIAS support for files
The ALIAS keyword can now be specified for any externally-described file.
If the ALIAS keyword is specified for a global file that is not qualified, the alternate names of the fields are available for use in the RPG program.
In the following example, the field REQALC in the file MYFILE has the alternate name REQUIRED_ALLOCATION. The ALIAS keyword indicates that the name for this field within the RPG program is REQUIRED_ALLOCATION.
dcl-f myfile ALIAS; read myfile; if required_allocation <> 0 and size > 0; ...
Relaxed rules for data structures for I/O operations
An externally-described data structure or LIKEREC data structure defined with type *ALL can be used as the result data structure for any I/O operation.
dcl-f myfile usage(*input : *output : *update); dcl-ds ds extname('MYFILE' : *ALL); read myfile ds; update myfmt ds; write myfmt ds;
When LIKEREC without the second parameter is used to define a data structure for DISK format, and the layout of the output buffer is identical to the input buffer, the data structure can be used as the result data structure for any I/O operation.
dcl-f myfile usage(*input : *output : *update); dcl-ds ds likerec(fmt); read myfile ds; update myfmt ds; write myfmt ds;
12 December 2019