COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-68
PICTURE Clause
You specify zero suppression and replacement by using a string of one or
more Z s or asterisks to represent leading numeric character positions that are
to be replaced when any of those positions in the data are zero. Any of the
simple insertion characters embedded in the string of symbols or to the
immediate right of this string are part of the string.
For zero suppression in a PICTURE character-string, you can either represent
any or all of the leading numeric character positions to the left of the decimal
point by Z s or asterisks or you can represent all of the numeric positions, right
or left of the decimal point, as Z s or asterisks.
If the suppression symbols appear only to the left of the decimal point, any
leading zero in the data that corresponds to the symbol is replaced by the
replacement character. Suppression terminates at the first nonzero digit in the
data represented by the suppression symbol string or at the decimal point,
whichever comes first.
If all numeric character positions in the PICTURE character-string are
represented by suppression symbols and the value of the data is not 0, the
result is the same as if the suppression characters were only to the left of the
decimal point. If the value is 0 and the suppression symbol is Z, the entire data
item is set to spaces. If the value is 0 and the suppression symbol is the
asterisk, the data item is set to all asterisks except for the actual decimal point.
In this case, the actual decimal point appears in the data item.
Only one of the symbols plus (+), minus (-), asterisk (*), Z, and the currency
symbol can be used as a floating replacement character within a single
PICTURE character-string.
Here are some examples of suppression editing:
Note. The caret (^) in the source item is the decimal point from its PICTURE
character-string.
Source Item PICTURE Edited Result
123456 $ZZZ,ZZZ.99 $123,456.00
1234^56 $ZZZ,ZZZ.99 $ 1,234.56
0 Z,ZZZ.ZZ 8 spaces
12^34 $
***,***.99 $*****12.34
0$
***,***.99 $*******.00
0$
***,***.** $*******.**