Summary -

In this topic, we described about the below sections -

The DISPLAY statement transfers the contents of operand to the output device. The contents are displayed on the output device in the order left to right. The DISPLAY statement transfers the data to the output device from the sending field. The size of the sending field is the total of bytes.

If the size of the data is less than the device maximum, the remaining right most positions are padded with spaces. If the size of the data is greater than the device maximum, the data fit to the device maximum is printed and remaining is continued in next record print.

Syntax -

DISPLAY Syntax

identifier-1

Identifier-1 references the data item is to be displayed. Identifier-1 can reference any data item except an item of usage INDEX. Identifier-1 can't be an index-name.If identifier-1 is a binary or internal decimal data item, identifer-1 is converted to zoned decimal.

If identifier-1 is a floating-point data item, identifer-1 is converted to external floating-point numbers. No other categories of data require conversion. Date fields are treated as nondates when specified in a DISPLAY statement. i.e., the DATE FORMAT is ignored, and the content of the data item is transferred to the output device as it is.

literal-1

Can be any literal or any figurative constant. When a figurative constant is specified, only a single occurrence of it is displayed.

UPON

UPON is an optional entry in DISPLAY statement. Environment-name-1 or the environment name must be associated with an output device. When the UPON phrase is omitted, the system's logical output device is assumed.

WITH NO ADVANCING

WITH NO ADVANCING is an optional entry in DISPLAY statement. If NO ADVANCING phrase specified, CURSOR places after the last character of current display statement operand. If NO ADVANCING phrase is not specified, the cursor on the output device is positioned at leftmost position of the next line.

Practicle Example -


 IDENTIFICATION DIVISION.                                        
 PROGRAM-ID.    ENVDWD.                                           
 ENVIRONMENT DIVISION.                                            
 CONFIGURATION SECTION.                                           
 SOURCE-COMPUTER. IBM-370 WITH DEBUGGING MODE.                    
*SOURCE-COMPUTER. IBM-370.                                        
 OBJECT-COMPUTER. IBM-370.                                        
 SPECIAL-NAMES.                                                   
 DATA DIVISION.                                                   
 PROCEDURE DIVISION.                                              
     DISPLAY 'DISPLAY STATEMENT USED TO PRINT IN SYSOUT..'.       
D    DISPLAY 'DISPLAY STATEMENT USED IN DEBUGGING MODE...'.      
     STOP RUN.