HP 3000 Manuals

DISPLAY Statement [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

DISPLAY Statement 

The DISPLAY statement can be used to transfer low volume data to the
operator's console, a terminal, or the line printer.  If more than one
name is specified, each data item is listed in the order specified in the
DISPLAY statement.

Syntax 

[]
Parameters identifier-1 and identifiers of data items, unsigned numeric integer literal-1 literals, the special registers (TALLY, TIME-OF-DAY, CURRENT-DATE, WHEN-COMPILED, LINAGE-COUNTER, and DEBUG-ITEM) and any figurative constant except ALL. SYSOUT in batch mode, the line printer. In session mode, it is the terminal from which the COBOL program was initiated. This is the default if the UPON phrase is not used. CONSOLE the operator's console. mnemonic-name the name specified by you, and defined under the SPECIAL-NAMES paragraph of the ENVIRONMENT DIVISION as either SYSOUT or CONSOLE. Description
NOTE I-O errors that occur during execution of the DISPLAY statement do not produce a "tombstone" since the I-O is not done by the file system.
If an item is described as USAGE COMPUTATIONAL, BINARY, COMPUTATIONAL-3, or PACKED-DECIMAL, the compiler translates it into a USAGE DISPLAY item for purposes of displaying it. If TIME-OF-DAY is used as an identifier, the time is displayed in edited form. That is, in the form, HH:MM:SS where HH is the hour taken from a 24 hour clock, MM is the number of minutes after the hour, and SS is the number of seconds after the minute. If a figurative constant is specified as an operand, only one occurrence of the constant is displayed. This is true even when the figurative constant ALL is specified. When a DISPLAY statement contains more than one operand, the size of the data to be transmitted is the sum of the sizes of all the operands. The values of the operands are transferred in the sequence in which the operands are listed. Length of Data Being Displayed. As with the ACCEPT statement, hardware record sizes determine the display of the data specified in the DISPLAY statement. The following methods are used, depending upon whether the size of the sending item is equal to, shorter than, or longer than the hardware device designated to receive the data: * If the sending item is the same length, no problem arises and the data is transmitted. * If the sending item is shorter than the device, the transferred data is displayed beginning with the leftmost position of the device, continuing to the right until all data characters have been displayed. * If the sending item is longer than can be displayed on one line of the device, the first line of the device is filled with as many characters as possible, then the next line is filled, and so forth until the entire sending item has been displayed. The order in which the sending data is displayed is the same as the order in which it is transmitted. The WITH NO ADVANCING Phrase. The WITH NO ADVANCING phrase of the DISPLAY statement provides interaction with a hardware device having vertical positioning. If the WITH NO ADVANCING phrase is specified, the positioning of the hardware device is not reset to the next line or changed in any other way following the display of the last operand. If the hardware device can be set to a specific character position, it remains set at the character position immediately following the last character of the last operand displayed. If the hardware device cannot be set to a specific character position, only the vertical position, if applicable, is affected. This may cause overprinting if the hardware supports [REV BEG] overprinting. If you redirect STDLIST to a file, the file must use carriage control (CCTL) or WITH NO ADVANCING has no effect. [REV END] If the WITH NO ADVANCING phrase is not specified, the positioning of the hardware device is reset to the leftmost position of the next line of the device after the last operand has been transferred to the hardware device. If vertical positioning is not applicable on the hardware device, the operating system ignores the vertical positioning that is specified or implied. Example 1 Following is an example DISPLAY statement: WORKING-STORAGE SECTION. 01 BEGIN-MSG PIC X(21) VALUE "_PROGRAM BEGINNING__". : PROCEDURE DIVISION. : DISPLAY CURRENT-DATE, BEGIN-MSG, TIME-OF-DAY UPON SYSOUT. If the date is Tuesday, July 30, 1991 at exactly 10:45 a.m. and the above DISPLAY statement is executed, the following message is displayed on the terminal where the program was run: 07/30/91_PROGRAM BEGINNING__10:45:00 Example 2 The following DISPLAY statement illustrates the WITH NO ADVANCING phrase: DISPLAY "ENTER CLASS CODE" WITH NO ADVANCING. ACCEPT CLASS-CODE. When the above statement is executed, the cursor is left on the same line as ENTER CLASS CODE on the screen: ENTER CLASS CODE uparrow Position of cursor following the display.


MPE/iX 5.0 Documentation