COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-73
USAGE Clause
•
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:
°
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.
°
Cannot have BLANK WHEN ZERO clause
A BLANK WHEN ZERO clause changes a numeric data item’s category from
numeric to numeric edited; therefore, the item cannot be
BINARY/COMPUTATIONAL.
°
COMPUTATIONAL data item with value 8224 or 224
In HP COBOL, if you find that a data item of USAGE COMPUTATIONAL has
the value 8224, it might be because it actually consists of 2 bytes, each
containing a space character. If it is described as consisting of 3 digits, it
appears to have the value 224.
°
See Trapping Size Errors.
PICTURE Range of Values
PICTURE 9(4) 0 through 9999
PICTURE S9(4) -9999 through 9999