COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-61
PICTURE Clause
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.
Numeric Data Items
An item is in the numeric category when its PICTURE character-string contains
only the symbols from the set: 9, P, S, and V. The number of digits described must
be greater than 0 and not more than 18. The contents are represented externally
as a combination of 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. If the S is present, the sign of
the value is retained.
The PICTURE character-string must include the symbol S if the item is described
with a SIGN clause. If the item inherits a SIGN clause from a data structure, the
PICTURE character-string cannot include the symbol S unless the item category is
DISPLAY.
Alphanumeric Data Items
An item is in the alphanumeric category when its PICTURE character-string
contains both 9 s and A s, or only X s, or a combination of 9 s, A s, and X s. A
PICTURE character-string of all A s or all 9 s is not an alphanumeric item. The item
is handled as if the string contained only X s. The contents of the item can be any
combination of characters.
Example 7-12. Alphabetic Data Items
05 PACKAGE-CODE PIC AAA.
15 DEPT-ID PIC A(12).
Example 7-13. Numeric Data Items
05 DIVISION-TOTAL PIC S9(10)V99.
05 FRACTION-AMOUNT PIC VPP99.
Example 7-14. Alphanumeric Data Items
10 STOCK-ITEM-NAME PIC X(25).
15 ZONE-ID PIC A(4)99.