COBOL Manual for TNS/E Programs (H06.03+)
Terminal Input and Output
HP COBOL Manual for TNS/E Programs—520347-003
29-14
Reading and Writing Numeric Data
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
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)










