The SIGN clause specifies the position and the mode of representation of the operational sign when it is necessary to describe
these properties explicitly.
General Format
Syntax Rules
- The SIGN clause can be specified only for a numeric data description entry whose PICTURE contains the character "S" , or a
group item containing at least one such numeric data description entry.
- The numeric data description entries to which the SIGN clause applies must be described, implicitly or explicitly, as USAGE
IS DISPLAY.
- At most one SIGN clause can apply to any given numeric data description entry.
This rule is removed.
- If the CODE-SET clause is specified, any signed numeric data description entries associated with that file description entry
must be described with the SIGN IS SEPARATE clause.
This restriction is not enforced. See the topic The CODE-SET Clause.
General Rules
- The optional SIGN clause, if present, specifies the position and the mode of representation of the operational sign for the
numeric data description entry to which it applies, or for each numeric data description entry subordinate to the group to
which it applies. The SIGN clause applies only to numeric data description entries whose PICTURE contains the character "S";
the "S" indicates the presence of, but neither the representation nor, necessarily, the position of the operational sign.
- A numeric data description entry whose PICTURE contains the character "S", but to which no optional SIGN clause applies, has
an operational sign, but neither the representation nor, necessarily, the position of the operational sign is specified by
the character "S". In this (default) case, General Rules 3 through 5 do not apply to such signed numeric data items. The representation
of the default operational sign is defined in the topic Selection of Character Representation and Radix in the chapter Concepts of the COBOL Language.
- If the optional SEPARATE CHARACTER phrase is not present, then:
- The operational sign is presumed to be associated with the leading (or, respectively, trailing) digit position of the elementary
numeric data item in a manner defined in the topic Selection of Character Representation and Radix in the chapter Concepts of the COBOL Language.
- The letter "S" in a PICTURE character-string is not counted in determining the size of the item (in terms of standard data
format characters).
- If the optional SEPARATE CHARACTER phrase is present, then:
- The operational sign is presumed to be the leading (or, respectively, trailing) character position of the elementary numeric
data item; this character position is not a digit position.
- The letter "S" in a PICTURE character-string is counted in determining the size of the item (in terms of standard data format
characters).
- The operational signs for positive and negative are the standard data format characters "+" and "-", respectively.
- Every numeric data description entry whose PICTURE contains the character "S" is a signed numeric data description entry.
If a SIGN clause applies to such an entry and conversion is necessary for purposes of computation or comparisons, conversion
takes place automatically.
- If a SIGN clause is specified for an item (either an elementary numeric data description entry or a group item) which is subordinate
to a group item for which a SIGN clause is also specified, then the SIGN clause specified in the subordinate item takes precedence.
- The SIGN clause is treated as documentary for external floating-point items. For internal floating-point items, the SIGN clause
is invalid and will result in a diagnostic message.