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.
Format .------------------. V | >>-DISPLAY----+-identifier-1-+-+--------------------------------> '-literal-1----' >--+------------------------------+-----------------------------> '-UPON--+-mnemonic-name-1----+-' '-environment-name-1-' >--+------------------------+---------------------------------->< '-+------+--NO ADVANCING-' '-WITH-'
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).
If the output is directed to CONSOLE, data items described with usage NATIONAL are converted from national character representation to EBCDIC. The conversion uses the EBCDIC code page that was specified in the CODEPAGE compiler option when the source code was compiled. National characters without EBCDIC counterparts are converted to default substitution characters; no exception condition is indicated or raised.
If the output is not directed to CONSOLE, data items described with usage NATIONAL are written without conversion and without data validation.
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. For proper results, the output device must have the capability to recognize DBCS shift-out and shift-in control characters.
Both DBCS and non-DBCS operands can be specified in a single DISPLAY statement.
A default logical record size is assumed for each device, as follows:
A maximum logical record size is allowed for each device, as follows:
On the system punch device, the last eight characters are used for PROGRAM-ID name.
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 Table 1.
For details on routing DISPLAY output to stdout, see the Enterprise COBOL Programming Guide.
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.
Enterprise COBOL does not support output devices that are capable of positioning to a specific character position. See the Enterprise COBOL Programming Guide for more information about the DISPLAY statement.
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.
Shift code insertion is required for splitting DBCS items. That is, when a DBCS operand is split across multiple records, the shift-in character is inserted at the end of the current record, and the shift-out character is inserted at the beginning of the next record. A space is padded after the shift-in character, if necessary. These inserted shift codes and spaces are included in the total byte count of the sending data items.
After the last operand has been transferred to the output device, the device is reset to the leftmost position of the next line of the device.
If a DBCS data item or literal is specified in a DISPLAY statement, the size of the sending field is the total byte count of all operands listed, with each DBCS character counted as two bytes, plus the necessary shift codes and spaces for DBCS.