The letter S indicates that a numeric field is signed. To specify that a numeric field is to have a sign, the letter S is added to the character string in the PICTURE clause.
The actual internal representation of the sign is controlled by the SIGN clause.
000010 @OPTIONS MAIN 000020*---------------------------------------------------------------------- 000030* The SIGN clause specifies the internal sign format. 000040*---------------------------------------------------------------------- 000050 IDENTIFICATION DIVISION. 000060 PROGRAM-ID. SAMPLE. 000070 DATA DIVISION. 000080 WORKING-STORAGE SECTION. 000090 77 UNSIGNED PIC 9(4). 000100 77 SIGNED PIC S9(4). 000110 77 TRAIL-SIGNED PIC S9(4) SIGN TRAILING. 000120 77 LEAD-SIGNED PIC S9(4) SIGN LEADING. 000130 77 TRAIL-SEP PIC S9(4) SIGN TRAILING SEPARATE. 000140 77 LEAD-SEP PIC S9(4) SIGN LEADING SEPARATE. 000150 PROCEDURE DIVISION. 000160*---------------------------------------------------------------------- 000170* For UNSIGNED data items, the value is stored as an absolute value. 000180* For the following, the contents of item UNSIGNED become X"31323334". 000190*---------------------------------------------------------------------- 000200 MOVE +1234 TO UNSIGNED. 000210 DISPLAY "+1234 -> 9(4) = " UNSIGNED. 000220*---------------------------------------------------------------------- 000230* For SIGNED, the sign is managed using the four high-order bits of the 000240* least significant digit in the same way as TRAILING SIGN format. 000250* (Positive: X"4x", Negative: X"5x") 000255* For the following, the contents of item SIGNED become X"31323344". 000260*---------------------------------------------------------------------- 000270 MOVE +1234 TO SIGNED. 000280 DISPLAY "+1234 -> S9(4) = " SIGNED. 000290*---------------------------------------------------------------------- 000300* For the TRAILING specification, the sign is managed using the four 000310* high-order bits of the least significant digit. (Positive: X"4x", 000320* Negative: X"5x") 000325* For the following, the contents of item TRAIL-SIGNED become 000327* X"31323344". 000330*---------------------------------------------------------------------- 000340 MOVE +1234 TO TRAIL-SIGNED. 000350 DISPLAY "+1234 -> S9(4) SIGN TRAILING = " TRAIL-SIGNED. 000360*---------------------------------------------------------------------- 000370* For the LEADING specification, the sign is managed using the four 000380* high-order bits of the most significant digit. (Positive: X"4x", 000390* Negative: X"5x") 000395* For the following, the contents of item LEAD-SIGNED become 000397* X"41323334". 000400*---------------------------------------------------------------------- 000410 MOVE +1234 TO LEAD-SIGNED. 000420 DISPLAY "+1234 -> S9(4) SIGN LEADING = " LEAD-SIGNED. 000430*---------------------------------------------------------------------- 000440* For the TRAILING SEPARATE specification, the sign is added to the 000450* right of the least significant digit using the character information. 000460* (Positive: X"2B", Negative: X"2D") 000465* For the following, the contents of item TRAIL-SEP become 000467* X"313233342B". 000470*---------------------------------------------------------------------- 000480 MOVE +1234 TO TRAIL-SEP. 000490 DISPLAY "+1234 -> S9(4) SIGN TRAILING SEPARATE = " TRAIL-SEP. 000500*---------------------------------------------------------------------- 000510* For the LEADING SEPARATE specification, the sign is added to the left 000520* of the most significant digit using the character information. 000530* (Positive: X"2B", Negative: X"2D") 000535* For the following, the contents of item LEAD-SEP become 000537* X"2B31323334". 000540*---------------------------------------------------------------------- 000550 MOVE +1234 TO LEAD-SEP. 000560 DISPLAY "+1234 -> S9(4) SIGN LEADING SEPARATE = " LEAD-SEP. 000570 END PROGRAM SAMPLE.