IBM Support

DATA-INTO opcode - new for 7.2 and 7.3 with PTFs

General Page

You are in: RPG Cafe > New DATA-INTO opcode for 7.2 and 7.3

Short URL: http://ibm.biz/data-into-rpg-opcode-ptfs

RPG Cafe: DATA-INTO opcode

The ILE RPG compilers for 7.2 and 7.3 are enhanced with the new DATA-INTO opcode.

DATA-INTO reads the data from a structured document, such as a JSON document, into a data structure.

DATA-INTO myDs
         
%DATA('myfile.json' : 'doc=file case=any countprefix=num')
          %PARSER('MYLIB/MYJSONPARS''boolean=ind');

It's quite similar to XML-INTO, except it handles any type of document. The reason it can handle any type of document is that you have to supply the parser for the document. You use the %PARSER built-in function to identify the parser program or procedure.

The source for a sample JSON parser is available in source member JSONPARSE in file QOAR/SAMPLE (after you get the PTF that provides the source files in QOAR).

PTFs

7.2:
  • ILE RPG runtime: SI67186
  • ILE RPG compiler: SI67184:
  • Source files in library QOAR for DATA-INTO: SI67182
7.3:
  • ILE RPG runtime: SI67187
  • ILE RPG compiler: SI67185
  • ILE RPG compiler, TGTRLS(V7R2M0): SI63445
  • Source files in library QOAR for DATA-INTO:  SI67183

New source members for DATA-INTO in library QOAR:

Files H, QCBLLESRC, and QRPGLESRC have the following changes:

  • Copy member QRNDTAINTO in source files QOAR/QRPGLESRC, QOAR/H and QOAR/QCBLLESRC. These copy members define the parameter that is passed to a parser for DATA-INTO.
  • Source file QOAR/SAMPLE, containing the source for
    • A JSON parser (source member JSONPARSE, for program JSONPARSE)
    • A small test for the JSON parser (source member JSONTEST)
    • Some parsers for a "properties" file (source member PROPPARSE, for service program PROPPARSE). It contains instructions for creating the service program.
    • Source member PROPPARSEB has the binder source for the PROPPARSE service program
    • Source member PROPPARSEC has the copy file for the service program, to be used in both the PROPPARSE source member, and in the PROPTEST* test members.
    • Several tests for the properties parser (source members PROPTEST*)

Note: The source in the QOAR/SAMPLE file is provided as-is. No support is provided by IBM for the source in this file, although PTFs for this file may be provided from time to time.

Warning: The source in the QOAR/SAMPLE file must be copied to a file or files in some other library if you want to make changes or additions. Further PTFs for this source file would overwrite any changes you made to the source members, and they would remove any additional source members you added.

Similarly, do not change or add members in the H, QCBLLESRC, or QRPGLESRC in library QOAR. If you want to make changes, copy the members to another source file.

Tip: To use the PROPPARSE* and PROPTEST* source without modification, copy the source members to a file called QRPGLESRC in your library list. If you put the PROPPARSEC member in a file with another name, or in a file that is not in your library list, you need to modify the "/COPY PROPPARSEC" directive in PROPPARSE, PROPTEST3, and PROPTEST4 to point to the location where you have the copy file.

RDi support

RDi supports the DATA-INTO starting in version 9.6.0.2.

Documentation in the IBM Knowledge Center

The ILE RPG Reference and ILE RPG Programmer's Guide in the 7.2 and 7.3 IBM Knowledge Center are updated with full information about DATA-INTO. Start at the What's New Since 7.2 or What's New Since 7.3 section in the Reference.

The Open Access: RPG Edition for 7.3 and 7.4 is updated with information about how to write a generator for the DATA-GEN operation code.

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure 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":"LOB57","label":"Power"}}]

Document Information

Modified date:
11 December 2019

UID

ibm11107723