COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-78
SIGN Clause
For an HP COBOL pointer to accomplish what an HP C or Pascal pointer
accomplishes, you must declare a base data item in the Linkage Section. You
must not put the base data item in the USING phrase of the PROCEDURE
DIVISION heading (that is, you must not pass the base data item as a
parameter).
SIGN Clause
The SIGN clause specifies the position and mode of representation of the operational
sign for a numeric data item. It can only be used for DISPLAY items with an S in the
PICTURE character-string. This precludes the use of the SIGN clause with USAGE
NATIVE-n or USAGE POINTER.
Usage Considerations:
Function of the SIGN Clause
The representation of every signed numeric data item includes an operational sign.
When the data item is USAGE BINARY or USAGE COMPUTATIONAL, the
compiler automatically chooses the appropriate sign convention in accordance with
the item’s internal representation. When the data item is USAGE DISPLAY, the
SIGN clause determines the position and representation of the sign. When no
SIGN clause is used, SIGN TRAILING is assumed.
When the SEPARATE phrase is present, the sign is maintained as a separate
character to be considered in the size of the item. A plus (+) for a positive value or
a minus (-) for a negative value is placed at the beginning or end of the item’s
value, depending on the presence of LEADING or TRAILING. If the sign character
position contains a value other than plus (+) or minus (-), any operation that uses
the item as a numeric sending item has undefined results.
If the SEPARATE phrase is absent, negative values are represented by a
modification of the high-order bit of the high-order or low-order digit of the stored
number (depending on the presence of LEADING or TRAILING). The sign is not
considered in the size of the item. For positive values of the data item, the value of
the sign bit is 0; for negative values, the value of the sign bit is 1.
Note. If you move a data item with an included sign to another item with a group move,
the character with a negative sign is not a legitimate COBOL character. This can cause
problems. Use an item with an included sign only in operations that expect numeric data.
LEADING
TRAILING
SEPARATE
CHARACTER
SIGN IS
VST100.vsd