COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-60
PICTURE Clause
A PICTURE character-string (or part of a PICTURE character-string) of the format
symbol (integer)
where symbol is any symbol allowed in a PICTURE character-string except P, is
equivalent to a PICTURE character-string (or substring) of integer consecutive
occurrences of symbol. For example, PICTURE X(4) is equivalent to PICTURE
XXXX and PICTURE A(3)0A is equivalent to PICTURE AAA0A.
The size of a DISPLAY item is determined by the PICTURE character-string
symbols. COMPUTATIONAL and BINARY items deviate from the rules for
DISPLAY items. See USAGE Clause. The amount of storage given to a data item
can exceed its size if the SYNCHRONIZED clause is used; however, any excess
bytes so allocated (called “implicit FILLER” bytes) belong not to the synchronized
item but to its parent item.
Trapping Size Errors
If a data item is described with a PICTURE clause, you must use the SIZE ERROR
Phrase to trap size errors that occur because the result of a calculation exceeds
the maximum number allowed by the PICTURE phrase. The SIZE ERROR phrase
is especially important for COMPUTATIONAL and BINARY items, because without
the SIZE ERROR phrase, you might not discover until much later that a value
larger than that allowed by the PICTURE was stored as the result of a
computation.
Categories of Data Items
The PICTURE clause can describe these categories of data items:
°
Alphabetic
°
Numeric
°
Alphanumeric
°
Alphanumeric edited
°
Numeric edited
°
National
The results of most statements in the Procedure Division depend on the categories
of the data items. Some statements disallow certain categories for some or all of
their operands. In other cases, the same statement can take distinctly different
actions when applied to data items of different categories.
In the remainder of this topic, 9 s and A s within the PICTURE character-string are
described as representing character positions that contain only numbers or letters
and spaces. For greater efficiency, the HP COBOL compilers do not always
enforce this restriction. Characters other than those permitted can be moved into
these positions if they appear in the corresponding positions of a sending data
item.