Sign in

docs RPG Reference

%DATA options for the DATA-GEN operation code

%DATA options for the DATA-GEN operation code

Several options are available for customizing the DATA-GEN operation. The options are specified as the second parameter of the %DATA built-in function. The parameter can be a constant or a variable expression. The options are specified in the form 'opt1=val1 opt2=val2'.

See %DATA (document {:options}) for more information on how to specify the options.

  • The doc option specifies whether the first parameter of the %DATA built-in function is a variable to receive the document, or whether it is the name of a file to receive the document.
  • The countprefix option specifies the prefix for the subfields that indicate how many elements of a counted array subfield should be generated, or whether a non-array subfield should be generated.
  • The fileccsid option specifies the CCSID to be used when creating the output file if the output file does not exist.
  • The name option specifies the name to be used for the top-level of the document.
  • The output option specifies whether the output variable or file should be cleared before the operation begins, or whether new data should be appended to exist data in the variable or file.
  • The renameprefix option specifies the prefix of the subfields that specify the name to be generated for a subfield instead of the name of the subfield itself..
  • The trim option specifies whether blanks should be trimmed from character, UCS-2, and graphic data before it is passed to the generator.