The DISPLAY statement transfers the contents of each operand to the output device. The contents are displayed on the output device in the order, left to right, in which the operands are listed.
The target file is determined by checking the COBOL environment-name (CONSOLE, SYSIN, SYSIPT, SYSOUT, SYSLIST, SYSLST, SYSPUNCH, and SYSPCH). If an environment variable is defined corresponding to the COBOL environment-name, the value of the environment-variable is used as the system file identifier. If the environment variable that corresponds to the COBOL environment name is not set, DISPLAY on SYSOUT, SYSLIST, or SYSLST is to the system logical output device (stdout).
For SYSPUNCH and SYSPCH, the DISPLAY statement fails unless the corresponding environment variable is set to point to a valid target. For more information about environment-variables, see the COBOL for Windows Programming Guide.
If identifier-1 is a binary, internal decimal, or internal floating-point data item, identifier-1 is converted automatically to external format as follows:
Data items defined with USAGE POINTER are converted to a zoned decimal number that has an implicit PICTURE clause of PIC 9(10).
Data items described with usage NATIONAL are converted to the code page associated with the current locale.
No other categories of data require conversion.
Date fields are treated as nondates when specified in a DISPLAY statement. That is, the DATE FORMAT is ignored and the content of the data item is transferred to the output device as is.
DBCS data items, explicitly or implicitly defined as USAGE DISPLAY-1, are transferred to the sending field of the output device.
Both DBCS and non-DBCS operands can be specified in a single DISPLAY statement.
When the UPON phrase is omitted, the system's logical output device is assumed. The list of valid environment-names in a DISPLAY statement is shown in Meanings of environment names (Table 5).
If the WITH NO ADVANCING phrase is not specified, after the last operand has been transferred to the output device, the positioning of the output device will be reset to the leftmost position of the next line of the device.
The DISPLAY statement transfers the data in the sending field to the output device. The size of the sending field is the total byte count of all operands listed. If the output device is capable of receiving data of the same size as the data item being transferred, then the data item is transferred. If the output device is not capable of receiving data of the same size as the data item being transferred, then one of the following applies:
If a DBCS operand must be split across multiple records, it will be split only on a double-byte boundary.