DISPLAY Statement Behavior

The DISPLAY statement transfers the data in the sending field to the output device. The size of the sending field is the total character count of all operands listed. If the hardware device is capable of receiving data of the same size as the data item being transferred, then the data item is transferred. If the hardware device is not capable of receiving data of the same size as the data item being transferred, then one of the following applies:
  • If the total character count is less than the device maximum logical record size, the remaining rightmost characters are padded with spaces.
  • If the total character count exceeds the maximum, as many records are written as are needed to display all operands. Any operand being printed or displayed when the end of a record is reached is continued in the next record.
  • IBM Extension
    IBM Extension If a DBCS or national operand must be split across multiple records, it splits only on a double-byte boundary. End of IBM Extension
    End of IBM Extension

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.

The logical record length depends on the device as follows:

Output Maximum Logical Record Size
Job log 120 characters
Workstation 58 characters
System operator's message queue 58 characters
IBM Extension

IBM Extension If a DBCS or national item or literal is specified in a DISPLAY verb, the size of the sending field is the total character count of all operands listed, with each DBCS or national character counted twice, plus all necessary shift codes for DBCS. End of IBM Extension

End of IBM Extension

When a program in a batch job processes a DISPLAY statement without the UPON phrase, or with an UPON phrase associated with the REQUESTOR, the output is sent to the job log in an informational message of severity 99. You can change the severity of this message using the Change Message Description (CHGMSGD) CL command. For more information, see theCL and APIs section of the Programming category in the IBM® i Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/

For an interactive job that uses display device files, DISPLAY statements are not normally used. If you do use them, the following considerations apply.

When an interactive job processes a DISPLAY statement, the logical record appears on the screen in the Program Messages display.

The following screen shows a sample Program Messages display.

                          Display Program Messages

JOB 000745/QPGMR/WS1 started on 02/17/92 at 14:50:22 in subsystem QINTER 1 
SAMPLE PROGRAM MESSAGE FROM PREVIOUS CALL OF PROGRAM. 2 
SAMPLE PROGRAM MESSAGE FROM CURRENT CALL OF PROGRAM. 2 

This display contains messages from the current program processing, as well as messages relating to other activities in the session.

When a DISPLAY statement is processed, the characteristics of the display device file on the screen determine whether or not to suspend program processing:
  • RSTDSP(*NO)

    If you specify this parameter when you change or create the display device file, DISPLAY statement processing suspends program processing, and the Program Messages display appears on the screen. Press Enter to resume program processing and immediately return the previous display to the screen.

  • RSTDSP(*YES)

    If you specify this parameter when you change or create the display device file, or run the DISPLAY statement from the Command Entry display, DISPLAY statement processing does not suspend program processing.

    The Program Messages display appears on the screen and remains there until either:
    • The program processes a nonsubfile READ or WRITE statement for the file. The Program Messages display then disappears, and the previous display returns to the screen.
    • The program ends.
    Note: If you want to suspend program processing, code an ACCEPT statement after the DISPLAY statement. This suspends program processing until you press Enter.

To view output records after the program terminates, press the F10 key from the Command Entry display.

For additional information on interactive processing, see the IBM Rational® Development Studio for i: ILE COBOL Programmer's Guide . For additional information on the RSTDSP parameter, see the CHGDSPF and CRTDSPF commands in the CL and APIs section of the Programming category in the IBM i Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/.

When a program started by a workstation operator sends a DISPLAY to the system operator’s message queue (separate from the workstation), program processing is not suspended.

The location of the output data is dependent upon the type of program initiation as follows:

Method of Initiation Mnemonic-Name Associated with SYSTEM-CONSOLE Mnemonic-Name Associated with REQUESTOR UPON Phrase Omitted
BATCH System operator’s message queue Job log Job log
INTERACTIVE System operator’s message queue Workstation Workstation