COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-64
PICTURE Clause
°
Simple insertion
The comma (,), space (B), zero (0 ), and slash (/) are used as the insertion
characters. They are counted in the item’s size and represent where that
character is inserted. The result of simple insertion editing is the appearance of
the insertion character within the edited item value in the same position as it
appears in the character-string. Here are some examples:
°
Special insertion
A period (.) is used as the insertion character and also acts as the decimal
point for alignment purposes. The insertion character used for the actual
decimal point is counted in the item’s size.
An assumed decimal point character (V ) and an actual decimal point character
(.) cannot both occur in the same PICTURE character-string. The result of
special insertion editing is the appearance of the insertion character within the
edited item value in the same position as it appears in the character-string.
Here are some examples. The caret (^) in each source item is the decimal
point location from its PICTURE character-string.
Note. Floating insertion editing and editing by zero suppression and replacement are mutually
exclusive in a single PICTURE clause, and only one of the two replacement types can be used
with zero suppression in a single PICTURE clause.
Source Item PICTURE Edited Result
123456 PIC 999,999 123,456
123456 PIC 99BBB9999 12 3456
1234 PIC 990099 120034
1234 PIC 99/99 12/34
123456 PIC 99B99B99 12 34 56
1234 PIC 999900 123400
13184 PIC 99/99/99 01/31/84
12345 PIC 999,999 012,345
"ABCD" PIC ABABABA A B C D
"1st2nd" PIC XXXB/BXXX 1st / 2nd
Source Item PICTURE Edited Result
1234^56 PIC 9999.99 1234.56
1^23456 PIC 9.99999 1.23456
1^23456 PIC 99.999999 01.234560
123^4 PIC 99.9999 23.4000
12^345 PIC 99.99 12.34