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

A COMPUTATIONAL-3/PACKED-DECIMAL data item with PICTURE S9999 and value -1234 is
stored as shown in Figure 9 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.
BINARY or COMPUTATIONAL Data Items
Purpose
The purpose of BINARY or COMPUTATIONAL items is to improve performance and
reduce the size of generated code (sometimes by a factor of as much as 100). Use
BINARY or COMPUTATIONAL for a value that can be represented in the number of digits
specified in the PICTURE clause; for example:
Range of ValuesPICTURE
0 through 9999PICTURE 9(4)
-9999 through 9999PICTURE S9(4)
PICTURE character-string contents
A BINARY/COMPUTATIONAL data item’s PICTURE character-string can contain only 9
s, the sign character S, the decimal point character V, and one or more P s. The PICTURE
clause for an elementary BINARY/COMPUTATIONAL data item must describe the item’s
category as numeric.
A BINARY/COMPUTATIONAL data item whose PICTURE character-string has one to four
9 s is stored as 16 bits.
A BINARY/COMPUTATIONAL data item whose PICTURE character-string has five or
more 9 s is stored as 4 or 8 bytes.
Cannot have or inherit SIGN clause
The description of a group or elementary data item with BINARY/COMPUTATIONAL
format cannot include or inherit a SIGN clause, because if such an item is signed, the
host computer’s architecture determines the representation of the sign.
206 Data Division