The DATA option specifies data-directed output.
The PUT DATA statement is equivalent to the PUT LIST statement, with the following differences:
- An
output-list item can be a scalar, element, array, or structure reference, not an expression. The reference may contain structure qualifiers and subscripts, but may not be locator qualified.
- The dataname of each reference is written along with the value. This is done in the form
dataname=value. If the value is an array, each element is written with its array name and the actual value of its subscript(s). If the value is a structure, each elementary member is written with its dataname fully qualified and with all subscripts at the end.
- The
dataname=value combinations are separated by spaces except when writing to a PRINT file, when each such item will be aligned on a TAB stop. A semicolon is written following the last value.
- The data values are written, in most cases, just as they are in PUT LIST. However, for character data, the data value is always enclosed in quotes when it is written out.
- A based variable in the
output-list must be declared with an explicit pointer.
Restriction: While IBM allows PUT DATA used without any specified variables as an undocumented feature of its z/OS PL/I product, this usage is not allowed in
Enterprise Developer. IBM allows it for the purpose of displaying all variable(s) and their values, but is typically used only for debugging purposes and is not used in production.