COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

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
(page 244) 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.
Because the COBOL language considers every data structure to be in the alphanumeric
category, manipulations upon data structures ignore all PICTURE constraints of their constituent
elementary items, including editing specifications. As an extreme (but quite legal) example,
an assignment to a containing data structure can cause any character position of an elementary
item to assume any character. If numeric items contain nonnumeric characters, the results of
using them in numeric operations are undefined.
Alphabetic Data Items
An item is in the alphabetic category when its PICTURE character-string contains only A s. The
contents of this type of item are represented externally as some combination of the 26
(uppercase or lowercase) letters of the alphabet and space character.
Example 45 Alphabetic Data Items
05 PACKAGE-CODE PIC AAA.
15 DEPT-ID PIC A(12).
196 Data Division