Sunday, 4 September 2016

Question on COMP in COBOL program

1. Sign storage in COMP-3 field,

The sign indicator is always stored at the last bit.
If your number is +100, it stores hex 0C in the last byte.
If your number is -101, it stores hex 1D in the last byte.

2. Sign stored in COMP field.

The Sign is stored in the Most significant bit.
Bit is ON if -ve.
Bit is OFF if +ve.

3. difference between COMP & COMP-3.

COMP is a binary storage format.
COMP-3 is a Packed decimal format.

4. difference between COMP-1 & COMP-2.

COMP-1 - Represented as Single floating point. Uses 4 bytes.
COMP-2 - Represented as Double floating point. Uses 8 bytes.

5. S9(7) COMP-3 field occupy?

According to the formula  INT((n + 1)/2) 
n=7
INT((7+1)/2)) = 4.
This will take 4 bytes.

6. S9(8) COMP field occupy?

4 bytes. As the number of bytes are divided by 2.

7. S9(7) SIGN TRAILING SEPARATE field occupy?

8 bytes as the sign will remain as 1 byte due to trailing separate.


No comments:

Post a Comment

Expense Handler Application with advance technologies

Budget Planner  One of the application developed with Ionic 4 and Python-Flask.  Ionic 4 code:  https://github.com/logeshbuiltin/Expense...