COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-49
DISPLAY
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.
°
Figurative constant values
A figurative constant is displayed as a single occurrence of the constant value
(even if the figurative constant includes the prefix ALL).
°
Multiple values
When you specify more than one value in a DISPLAY statement, DISPLAY
combines the values (in the order you specify them) into a single character-
string and displays the character-string. The size of the displayed item is the
sum of the sizes of all the values.
If the character-string exceeds the line capacity of the device, DISPLAY
displays the data as a sequence of lines. Every line except (perhaps) the last
one contains its maximum number of characters. The last line contains
whatever characters are left, up to the maximum.