Summary -
In this topic, we described about the SIGN Clause with detailed example.
The SIGN clause specifies the position and representation mode of the sign. The SIGN clause specifies in declaration when the sign required to store the sign value in additional byte.
Syntax -

- LEADING Specifies that the sign is at the beginning of the data item.
- TRAILING Specifies that the sign is at the end of the data item.
- SEPARATE Specifies that the sign is not over punched on last/first char of the data item and sign separately occupies the first or last character of the data item.
The SIGN clause can be specified only for the following items -
- An elementary numeric data item of usage DISPLAY.
- A group item that contains at least one such elementary entry as a subordinate item.
When the SIGN clause is specified without the SEPARATE phrase, USAGE DISPLAY must be specified explicitly or implicitly. When SIGN IS SEPARATE is specified, USAGE DISPLAY can be specified.
If the SEPARATE CHARACTER phrase is not specified, then -
- The sign is presumed to be associated with the LEADING or TRAILING digit position.
- The character 'S' in the PICTURE character string is not counted in determining the size of the item.
If the SEPARATE CHARACTER phrase is specified, then -
- The operational sign is presumed to be the LEADING or TRAILING character position. This character position is not a digit position.
- The character 'S' in the PICTURE character string is counted in determining the size of the data item.
+ is the character used for the positive operational sign.
- is the character used for the negative operational sign.
The SEPARATE CHARACTER phrase cannot be specified for a date field.
Practical Example -
Scenario - Below example describes about the sign data type declaration and usage in COBOL programming.
Code -

=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 IDENTIFICATION DIVISION.
000002 PROGRAM-ID. SIGNDT.
000003 AUTHOR. MTH.
000004
000005 DATA DIVISION.
000006 WORKING-STORAGE SECTION.
000007 01 WS-VARS.
000008 05 WS-SIGN-NO-SEP-P PIC S9(03) VALUE +256.
000009 05 WS-SIGN-LS-P PIC S9(03) VALUE +256
000010 SIGN IS LEADING SEPARATE CHARACTER.
000011 05 WS-SIGN-TS-P PIC S9(03) VALUE +256
000012 SIGN IS TRAILING SEPARATE CHARACTER.
000013 05 WS-SIGN-NO-SEP-N PIC S9(03) VALUE -256.
000014 05 WS-SIGN-LS-N PIC S9(03) VALUE -256
000015 SIGN IS LEADING SEPARATE CHARACTER.
000016 05 WS-SIGN-TS-N PIC S9(03) VALUE -256
000017 SIGN IS TRAILING SEPARATE CHARACTER.
000018
000019 PROCEDURE DIVISION.
000020
000021 DISPLAY "SIGN +VE WITH NO SEPARATE : " WS-SIGN-NO-SEP-P.
000022 DISPLAY "SIGN +VE LEADING SEPARATE : " WS-SIGN-LS-P.
000023 DISPLAY "SIGN +VE TRAILING SEPARATE : " WS-SIGN-TS-P.
000024 DISPLAY " ".
000025
000026 DISPLAY "SIGN -VE WITH NO SEPARATE : " WS-SIGN-NO-SEP-N.
000027 DISPLAY "SIGN -VE LEADING SEPARATE : " WS-SIGN-LS-N.
000028 DISPLAY "SIGN -VE TRAILING SEPARATE : " WS-SIGN-TS-N.
000029
000030 STOP RUN.
****** **************************** Bottom of Data ****************************
Output -
