COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-65
PICTURE Clause
°
Fixed insertion
The currency symbol and the editing sign control symbols (+, -, CR, DB) are
the insertion characters. Only one currency symbol and one of the editing
control symbols can be used in a PICTURE character-string. CR and DB
represent two positions when counting an item’s size. When used, they must
be in the rightmost positions. When a plus (+) or minus (-) is used, it must be in
either the leftmost or rightmost character position to be counted in the item’s
size. When the currency symbol is used, it must be the leftmost character,
except when preceded by either a plus (+) or minus (-). Only one currency
symbol and only one of the editing sign control characters can be used in the
same PICTURE character-string. The result of fixed insertion editing is the
appearance of the insertion characters within the item value in the same
positions as they appear in the PICTURE character-string.
Here are some examples of fixed insertion editing. The caret (^) in each source
item is the decimal point location from its PICTURE character-string.
Table 7-4. Sign Control Symbols
Editing Symbol
Result
Positive or Zero Data Item Negative Data Item
++ -
- space -
CR 2 spaces CR
DB 2 spaces DB
Source Item PICTURE Edited Result
12^34 PIC 99.99+ 12.34+
-12^34 PIC 99.99+ 12.34-
12^34 PIC +$99.99 +$12.34
-12^34 PIC +$99.99 -$12.34
12^34 PIC $99.99- $12.34
-12^34 PIC $99.99- $12.34-
12^34 PIC -$99.99 $12.34
-12^34 PIC -$99.99 -$12.34
12^34 PIC 99.99CR 12.34
-12^34 PIC 99.99CR 12.34CR
12^34 PIC $99.99DB $12.34
-12^34 PIC $99.99DB $12.34DB