COBOL Manual for TNS/E Programs (H06.03+)

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-46
DISPLAY
If INVOICE-NUMBER is 00246, the output from the code in Example 9-3 looks like this:
I-O ERROR 23 - NO RECORD FOR KEY = 00246
Usage Considerations:
Differences in the OSS and Guardian Environments
In the OSS environment (but not in the Guardian environment), if a DISPLAY
statement includes mnemonic-name, it must be either the OSS pathname of a
Guardian file or the name of an OSS text file.
Devices
The devices to which the DISPLAY statement can transmit data are terminals
(including the operator’s console), printers, processes (including spooler
collectors), and entry-sequences files. Once the DISPLAY device is assigned, the
program cannot change it. The WRITE statement is recommended for all but the
smallest amounts of data.
Specifying the Wrong Device
If you specify a device that cannot be used for DISPLAY output, the process
displays a run-time error message and the output on its home terminal. The error
message includes this line:
Device assigned to ACCEPT or DISPLAY not a legal device
Opening and Closing Devices
The display operation opens and closes the terminal or printer (but not a process)
for each DISPLAY statement. This prevents a COBOL program from locking out
other users between displays. Because a process is not prevented from accepting
requests from other run units, COBOL does not close a process after each display
operation; instead, it waits until execution of the run unit terminates.
How Different Types of Values Are Displayed
°
Numeric values
A numeric value is displayed as a numeric literal, preceded by a minus sign if
the value is negative, and with a decimal point before any fractional digits. The
number of digits displayed is the number of digits defined for the sending item.
A function that returns a floating-point value (such as NUMVAL or NUMVAL-C)
is displayed as if the value were described as PICTURE S9(18), with no
decimal positions. For this reason, do not reference such functions in DISPLAY
statements. Instead, move the values that such functions return to temporary
variables that have decimal points in the appropriate positions and display the
temporary variables.
°
Nonnumeric values
A nonnumeric value is displayed as a string of characters.