IBM Support

New for RPG in IBM i 7.1 and 7.2 - Full ALIAS support and easier result data structure for IO

General Page

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

PTFs

7.1:
  • ILE RPG compiler: SI54502
7.2:
  • 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.

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;

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SS69QP","label":"Rational Development Studio for i"},"Component":"ILE RPG Compiler","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
12 December 2019

UID

ibm11108173