Cobol- Signed Number and Memory

This is very interesting. one day my old colleague went for an interview. He was asked-tell something about signed numbers.

The field we define when sign is involved is PIC S9(2). We can enter two digit negative value. For example, -24.

  • Developer has to remember is, in the file, the signed numbers we can not see. When you use file-aid you can see the value.
  • PIC S9(4) Sign is Leading Separate , means -1234. When sign is stored separately, it takes total memory 5 bytes.
  • PIC S9(4) Sign is Trailing Separate , means 1234-. When sign is stored separately, it takes total memory 5 bytes.
  • In PIC S9(4)- Sign is implied decimal point, it does not take memory, so, total 4 bytes it will take

The positive values are Letter A-I. The negative values are Letter J-R.

Positive Values: +1  to +9 (A-I)

Negative Values: -1 to -9 (J-R)

For “0” it will take as “}”.

Enjoy reading…

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.