Sign Clause
The SIGN clause enables a printable sign character to be produced automatically when the PICTURE has an "S" symbol.
Sign Clause: Coding Rules
-
If you write a SIGN clause in an elementary entry, the entry must have a numeric PICTURE with an "S" symbol.
-
This clause acts on elementary fields, but you may also code it in a group level entry, where it applies to all numeric elementary entries within the group whose PICTUREs begin with the "S" symbol.
-
Format b is unique to the REPORT SECTION. Each literal must be a single character non-numeric literal. At least one of the phrases must be present.
Sign Clause: Operation
-
The use of the format a SIGN clause has been superseded by the "+" and "-" symbols of the PICTURE clause. It is included for consistency with basic COBOL standards. Refer to your COBOL language reference for further information.
-
The format b SIGN clause enables you to place symbols of your choice on the left or the right of any signed printed item to represent a negative amount. The LEADING literal (if specified) is placed immediately before the first character of the report field. If leading spaces are suppressed with the Z or floating currency symbol, the literal is placed immediately before the first non-space character. The TRAILING literal (if specified) is placed in the last character position. For example, to place parentheses around a negative payment (a common accounting requirement), you would code:
PIC SZZZ9 SIGN IS LEADING "(" TRAILING ")" SOURCE PAY
.which would output a value of -12 as: (12)
while a value of -1234 appears as: (1234)
This feature can be made to work for positive values by specifying the negative of the source (SOURCE (- PAY) in the case above).
Compatibility
The use of the SIGN clause in the report section is allowed only by new Report Writer, which uniquely provides the LEADING literal TRAILING literal phrases.