Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


DISPLAY statement

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.

Format
Read syntax diagramSkip visual syntax diagram            .------------------.  
            V                  |  
>>-DISPLAY----+-identifier-1-+-+-------------------------------->
              '-literal-1----'    
 
>--+------------------------------+----------------------------->
   '-UPON--+-mnemonic-name-1----+-'  
           '-environment-name-1-'    
 
>--+------------------------+----------------------------------><
   '-+------+--NO ADVANCING-'  
     '-WITH-'                  
 
identifier-1
Identifier-1 references the data that is to be displayed. Identifier-1 can reference any data item except an item of usage PROCEDURE-POINTER, FUNCTION-POINTER, OBJECT REFERENCE, or INDEX. Identifier-1 cannot be an index-name.

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.

literal-1
Can be any literal or any figurative constant as specified in Figurative constants. When a figurative constant is specified, only a single occurrence of that figurative constant is displayed.

UPON
environment-name-1 or the environment name associated with mnemonic-name-1 must be associated with an output device. See SPECIAL-NAMES paragraph.

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).

WITH NO ADVANCING
When specified, the positioning of the output device will not be changed in any way following the display of the last operand. If the output device is capable of positioning to a specific character position, it will remain positioned at the character position immediately following the last character of the last operand displayed. If the output device is not capable of positioning to a specific character position, only the vertical position, if applicable, is affected. This can cause overprinting.

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.


Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)