RPG – DATA-INTO

The DATA-INTO operation imports the data from a structured document into an RPG variable.

The DATA-INTO operation passes the document text to the parser, which uses callback functions to gradually pass the names and values of the data in the document to the DATA-INTO operation. The DATA-INTO operation places the information into the target RPG variable.

Options can be set to instruct the DATA-INTO operation and the parser how the parsing should be handled.

Options:

  • doc=file
    – Indicates the the text document should be read from the IFS. The path and the filename is place in the variable of the first %data parameter.
  • case=any (default is yes)
    – Indicates that the mapping of the name of the document is case insensitive.
  • trim=none (default is all)
    – Indicates if leading and trailing blank characters should be trimmed or not when moved into matching variable.
  • allowmissing=yes (default is no)
    – Indicates that names/keys in the text document can be less than in the receiving RPG variable/datastructure.
  • allowextra=yes (default is no)
    – Indicates that names/keys in the text document can be more than in the receiving RPG variable/datastructure.
  • countprefix=count_
    – Defines how count variables can be named in the datastructure for multiple dimensioned structures. The number of loaded elements will be stored in the count varable after the completed parsing.

Example