COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-72
USAGE Clause
A COMPUTATIONAL-3/PACKED-DECIMAL data item with PICTURE 9999 and value
+1234 is stored as shown in Figure 7-3, where F represents the nonprinting plus sign.
A COMPUTATIONAL-3/PACKED-DECIMAL data item with PICTURE S9999 and value
+1234 is stored as shown in Figure 7-3 except that F is replaced by C (1100), which
represents the plus sign (+).
A COMPUTATIONAL-3/PACKED-DECIMAL data item with PICTURE S9999 and value
-1234 is stored as shown in Figure 7-3 except that F is replaced by D (1101), which
represents the minus sign (-).
Usage Considerations:
•
National Data Items Cannot Have USAGE Clauses
Verify that national data items do not have USAGE clauses (inherited, explicit, or
implicit) and are not mixed with nonnational data items in group descriptions.
•
USAGE Clause Rarely Restricts Actual Usage
The USAGE clause describes a data item, but rarely restricts how the item is
actually used. Exceptions are USAGE INDEX, USAGE POINTER, and rules for
certain statements that require the DISPLAY phrase or default to USAGE
DISPLAY.
•
USAGE Clause Applies to Both Elementary and Data Structures
Any level of a data description can have a USAGE clause. A USAGE clause at the
group level applies to each elementary item in the group, and the USAGE of an
elementary item cannot contradict the USAGE clause of a group to which the item
belongs. Because data structures are always in the alphanumeric category, their
USAGE clauses might not always apply to their own manipulation, for example:
The subitems of a BINARY/COMPUTATIONAL data structure can be used in
computations, but the data structure itself cannot.
The subitems of an INDEX data structure are index data items, but the data
structure itself is not.
The subitems of a POINTER data structure are pointers, but the data structure
itself is not.
Figure 7-3. Example of COMPUTATIONAL-3/PACKED-DECIMAL Storage
...
1234F
0000 0001 0010 0011 0100 1111
1 byte
VST601.vsd