VMS Help  —  COBOL  PROCEDURE_DIVISION, DISPLAY
  The DISPLAY statement transfers low-volume data from the program to
  the default system output device or to the object of a mnemonic-name.
  The HP extensions to the DISPLAY statement, Formats 2 and 3, are
  COBOL language additions that facilitate video forms design and data
  handling. Format 4 sets a program variable to the current command line
  argument number to read with a Format 7 ACCEPT. Format 5 sets the name
  of an environment variable or system logical while Format 6 sets the
  value of an environment variable or system logical.

1  –  1format_statement

  The DISPLAY statement transfers low-volume data from the program to
  the default system output device or to the object of a mnemonic-name.
  The HP extensions to the DISPLAY statement (formats 2 and 3) are
  COBOL language additions that facilitate video forms design and data
  handling.

  Format 1 -

   DISPLAY { src-item } ... [ UPON output-dest ] [ WITH NO ADVANCING ]
                            [ WITH CONVERSION]
      [ END-DISPLAY ]

1.1  –  src-item

  is a literal or the identifier of a data item.  The literal can be
  any figurative constant including ALL literal.

1.2  –  output-dest

  is a mnemonic-name defined in the SPECIAL-NAMES paragraph of the
  Environment Division.

2  –  2format_screen_extensions

  The DISPLAY statement transfers low-volume data from the program to
  the default system output device or to the object of a mnemonic-name.
  The HP extensions to the DISPLAY statement (formats 2 and 3) are
  COBOL language additions that facilitate video forms design and data
  handling.

  Format 2 -

   DISPLAY { src-item

      [{|                { line-num                      }      |}] }
      [{| AT LINE NUMBER { line-id [ PLUS [ plus-num ] ] }      |}] }
      [{|                { PLUS [ plus-num ]             }      |}] }
      [{|                  { column-num                       } |}] }
      [{| AT COLUMN NUMBER { column-id [ PLUS [ plus-num ] ]  } |}] }
      [{|                  { PLUS [ plus-num ]                } |}] }
      [{| ERASE [TO END OF] { SCREEN }                          |}] } ...
      [{|                   { LINE   }                          |}] }
      [{| WITH BELL                                             |}] }
      [{| UNDERLINED                                            |}] }
      [{| BOLD                                                  |}] }
      [{| WITH BLINKING                                         |}] }
      [{| REVERSED                                              |}] }
      [{| WITH CONVERSION                                       |}] }

      [ WITH NO ADVANCING ]
      [ END-DISPLAY ]

2.1  –  src-item

  is a literal or the identifier of a data item.  The literal can be
  any figurative constant except ALL literal.

2.2  –  output-dest

  is a mnemonic-name defined in the SPECIAL-NAMES paragraph of the
  Environment Division.

2.3  –  line-num

  is a numeric literal that specifies a line position on the terminal
  screen.  Line-num must be a positive integer.  It cannot be zero.

2.4  –  line-id

  is the identifier of a data item that provides a line position on the
  terminal screen.

2.5  –  column-num

  is a numeric literal that specifies a column position on the terminal
  screen.  Column-num must be a positive integer.  It cannot be zero.

2.6  –  column-id

  is the identifier of a data item that provides a column position on
  the terminal screen.

2.7  –  plus-num

  is a numeric literal that increments the current value for line or
  column position, or that increments the value of line-id or
  column-id.  Plus-num can be zero or a positive integer.

3  –  3format_screen_section_extensions

  The DISPLAY statement transfers low-volume data from the program to
  the default system output device or to the object of a mnemonic-name.
  The HP extensions to the DISPLAY statement (formats 2 and 3) are
  COBOL language additions that facilitate video forms design and data
  handling.

  Format 3 -

   DISPLAY screen-name

      [    {| LINE NUMBER { line-num }     |} ]
      [    {|             { line-id  }     |} ]
      [ AT {|                              |} ]
      [    {| COLUMN NUMBER { column-num } |} ]
      [    {|               { column-id  } |} ]

      [ END-DISPLAY ]

3.1  –  screen-name

  is the name of a screen item defined in the SCREEN SECTION of the
  program.

3.2  –  line-num

  is a numeric literal that specifies a line position on the terminal
  screen.  Line-num must be a positive integer.  It cannot be zero.

3.3  –  line-id

  is the identifier of a data item that provides a line position on
  the terminal screen.

3.4  –  column-num

  is a numeric literal that specifies a column position on the terminal
  screen.  Column-num must be a positive integer.  It cannot be zero.

3.5  –  column-id

  is the identifier of a data item that provides a column position on
  the terminal screen.

4  –  4format_arg_position_extensions

  When a Format 4 DISPLAY statement is specified, the value stored in
  arg-position is moved to argument-number. This updates the current
  argument position indicator for the command line. See ARGUMENT-NUMBER
  in the SPECIAL-NAMES paragraph. This point to to selected argument to
  be read by a Format 7 ACCEPT statement.

  Format 4 -

   DISPLAY arg-position UPON argument-number
      [ END-DISPLAY ]

4.1  –  arg-position

  is a literal or identifier that specifies the desired argument
  position on the run command line. It must be an unsigned integer.

4.2  –  argument-number

  is a mnemonic name associated with argument-number in the
  SPECIAL-NAMES paragraph in the Environment Division, representing
  the name of an environment variable or system logical.

5  –  5format_envlog_name_extensions

  When a Format 5 DISPLAY statement is specified, the value stored in
  envlog-name is moved to environment-name. See ENVIRONMENT-NAME in
  the SPECIAL-NAMES paragraph. The updated value of environment-name
  becomes the environment variable or logical to be accessed by
  subsequent Format 6 DISPLAY and Format 8 ACCEPT statements.

  Format 5 -

   DISPLAY envlog-name UPON environment-name
      [ END-DISPLAY ]

5.1  –  envlog-name

  references an alphanumeric data item, or is a nonnumeric literal.

5.2  –  environment-name

  is a mnemonic name associated with ARGUMENT-NUMBER in the
  SPECIAL-NAMES paragraph in the Environment Division, representing
  the name of an environment variable or system logical.

5.3  –  Example

  Example of Formats 5 and 6.

 IDENTIFICATION DIVISION.
 PROGRAM-ID. SAMPLE.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SPECIAL-NAMES.
   ENVIRONMENT-NAME    IS NAME-OF-EVAR
   ENVIRONMENT-VALUE   IS VALUE-OF-EVAR.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01 NAME-1                  PIC X(20).
 01 VALUE-ACCEPTED          PIC X(20).
 PROCEDURE DIVISION.
 P1.
 *       The name of the environment variable
         MOVE "TESTPATH1" TO NAME-1.

 *       Create an environment with the name "TESTPATH1"
         DISPLAY NAME-1 UPON NAME-OF-EVAR.

 *       Set the value of "TESTPATH1"
         DISPLAY "/USER/MYNAME" UPON VALUE-OF-EVAR.

 *       Read the value of TESTPATH1 into a variable
         ACCEPT VALUE-ACCEPTED FROM VALUE-OF-EVAR.

 *       Display the value of TESTPATH1"
         DISPLAY VALUE-ACCEPTED.

         STOP RUN.

6  –  6format_envlog_value_extensions

  When a Format 6 DISPLAY statement is specified, environment-value
  receives the value stored in envlog-value. The environment variable
  or logical is the one named by a Format 5 DISPLAY statement. See
  ENVIRONMENT-VALUE in the SPECIAL-NAMES paragraph.

  Format 6 -

   DISPLAY envlog-value UPON environment-value

      [ ON EXCEPTION stment ]
      [ NOT ON EXCEPTION stment2 ]

      [ END-DISPLAY ]

6.1  –  envlog-value

  references an alphanumeric data item, or is a nonnumeric literal.

6.2  –  environment-value

  is a mnemonic name associated with ENVIRONMENT-VALUE in the
  SPECIAL-NAMES paragraph in the Environment Division, representing
  the contents of the variable associated with the  ENVIRONMENT-NAME.

6.3  –  Example

  Example of Formats 5 and 6.

 IDENTIFICATION DIVISION.
 PROGRAM-ID. SAMPLE.
 ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
 SPECIAL-NAMES.
   ENVIRONMENT-NAME    IS NAME-OF-EVAR
   ENVIRONMENT-VALUE   IS VALUE-OF-EVAR.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01 NAME-1                  PIC X(20).
 01 VALUE-ACCEPTED          PIC X(20).
 PROCEDURE DIVISION.
 P1.
 *       The name of the environment variable
         MOVE "TESTPATH1" TO NAME-1.

 *       Create an environment with the name "TESTPATH1"
         DISPLAY NAME-1 UPON NAME-OF-EVAR.

 *       Set the value of "TESTPATH1"
         DISPLAY "/USER/MYNAME" UPON VALUE-OF-EVAR.

 *       Read the value of TESTPATH1 into a variable
         ACCEPT VALUE-ACCEPTED FROM VALUE-OF-EVAR.

 *       Display the value of TESTPATH1"
         DISPLAY VALUE-ACCEPTED.

         STOP RUN.
Close Help