Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 6: Procedure Division


DISPLAY verb

  • DISPLAY statement is used to display messages and data values on the screen
  • DISPLAY is also used to display several data items or literals or any combination of these
  • By default, display messages are send to SYSOUT
  • When DISPLAY is coded for debugging purpose, character ‘D’ is specified on column 7 of coding sheet. <link to coding sheet> These lines will be displayed in SYSOUT only when DEBUGGING MODE is enabled. If DEBUGGING MODE is not enabled, DISPLAY statements with ‘D’ in 7th column position will be treated as comment
  • Basic syntax:-

    DISPLAY {identifier/literal} [{identifier/literal}]…           [WITH NO ADVANCING]

  • When more than one operand is specified, the values of operands are displayed in the sequence they are specified
  • There will be no space between these values
  • literal may be any literal/figurative-constant except the ALL literal
  • When figurative constant is specified, only one occurrence of the constant is displayed
  • The “WITH NO ADVANCING” clause suppresses the carriage-return/line-feed
  • Example 1:-
    In PROCEDURE DIVISION,

    DISPLAY ‘RECORDS WRITTEN: ‘ WS-REC-COUNT.

    If WS-REC-COUNT is having PIC 9(4) and value is 1430, then upon execution of above DISPLAY statement, the following will be displayed in SYSOUT:-
    SYSOUT Display:-

    RECORDS WRITTEN: 1430

  • Example 2:-
    In PROCEDURE DIVISION,

    DISPLAY WS-REC-COUNT.

    If WS-REC-COUNT is having PIC 9(4) and value is 1430, then upon execution of above DISPLAY statement, it will just display the content of the WS-REC-COUNT as shown below:-
    SYSOUT Display:-

    1430






© copyright mainframebug.com
Privacy Policy