COBOL Manual for TNS and TNS/R Programs
Terminal Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
29-14
Logging Program Activity Information to a Terminal
A record of the output of one execution of the program in Example 29-6 follows. Each
ACCEPT statement interprets the characters entered at each prompt (?) the same way
as it would interpret those characters as a numeric literal in a source program. Each
DISPLAY statement converts the value of a data item to a character-string that
represents a numeric value for display.
?-1234.5678
01234
?-1234.5678
234.567
?-1234.5678
-234.567
?-1234.5678
234.567
?-1234.5678
1234.5678
?-1234.5678
-0001234.5678000
Logging Program Activity Information to a
Terminal
Whenever a process sends a message to the system operator console terminal device
($0), the operating environment can automatically duplicate the message to the
standard log file, which can be a terminal.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PICTURE 99999.
01 B PICTURE 999V999.
01 C PICTURE S999V999.
01 D PICTURE 999.999.
01 E PICTURE 9999V9999 USAGE IS COMPUTATIONAL.
01 F PICTURE
USAGE IS COMPUTATIONAL.
PROCEDURE DIVISION.
Z.
ACCEPT A. DISPLAY A.
ACCEPT B. DISPLAY B.
ACCEPT C. DISPLAY C.
ACCEPT D. DISPLAY D.
ACCEPT E. DISPLAY E.
ACCEPT F. DISPLAY F.
STOP RUN.
Example 29-6. Reading and Writing Numeric Data (page 2 of 2)