Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

PUT edit-directed

For more information about the PUT statement, see PUT statement.

The value of each data-list item is converted to the character or graphic representation specified by the associated data-format item and placed in the stream in a field whose width also is specified by the format item. When the data list has been processed, execution of the PUT statement stops and any remaining format items are not processed.

On output, binary items are converted to decimal values and the associated F- or E-format items must state the field width and point placement in terms of the converted decimal number. For the P-format these are specified by the picture specification.

On output, blanks are not inserted to separate data values in the output stream. String data is left-adjusted in the field to the width specified. Arithmetic data is right-adjusted. Because of the rules for conversion of arithmetic data to character type which can cause up to 3 leading blanks to be inserted (in addition to any blanks that replace leading zeros), generally there is at least 1 blank preceding an arithmetic item in the converted field. Leading blanks do not appear in the stream, however, unless the specified field width allows for them. Truncation, due to inadequate field-width specification, is on the left for arithmetic items, and on the right for string items. SIZE or STRINGSIZE is raised if truncation occurs.

Example 1

  put edit('Inventory='||Inum,Invcode)(A,F(5));

This example specifies that the character string 'Inventory=' is concatenated with the value of Inum and placed in the stream in a field whose width is the length of the resultant string. Then the value of Invcode is converted to character, as described by the F-format item, and placed in the stream right-adjusted in a field with a width of five characters (leading characters can be blanks).

Example 2

The following example shows the use of the COLUMN, LINE, PAGE, and SKIP format items in combination with one another:

  put edit ('Quarterly Statement')
      (page, line(2), A(19))(Acct#, Bought, Sold, Payment, Balance)
      (skip(3), A(6), column(14), F(7,2), column(30), F(7,2),
      column(45), F(7,2), column(60), F(7,2));

This PUT statement specifies the following:

  1. The heading Quarterly Statement is written on line two of a new page in the output file SYSPRINT.
  2. Two lines are skipped. The next line in the output is the third line following the heading, or the fifth line of the report.
  3. The following values are written:

Example 3

In the following example, the value of Name is inserted in the stream as a character string left-adjusted in a field of N characters.

  put edit (Name,Number,City) (A(N),A(N-4),A(10));

Number is left-adjusted in a field of N-4 characters; and City is left-adjusted in a field of 10 characters.


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)