Home > Software > Mainframe > Cobol
Interview Questions   Tutorials   Discussions   Programs   

Cobol - What is the difference between comp and comp-3 usage? Explain other COBOL usage?




597
views
asked mar August 3, 2014 12:07 AM  

What is the difference between comp and comp-3 usage? Explain other COBOL usage?


           

1 Answers



 
answered By Mswami   0  

COMP is a binary storage format while COMP-3 is packed decimal format.

Cobol Usage Clause:

DISPLAY    Default. Number of bytes required equals to the size of the data item.
COMP    Binary representation of data item.
PIC clause can contain S and 9 only.
S9(01) – S9(04)  Half word.
S9(05) – S9(09)  Full word.
S9(10) - S9(18)  Double word.
Most significant bit is ON if the number is negative.

COMP-1    Single word floating point item. PIC Clause should not be specified.

COMP-2    Double word floating-point item. PIC Clause should not be specified.

COMP-3    Packed Decimal representation. Two digits are stored in each byte.
   
                Last nibble is for sign. (F for unsigned positive, C for signed positive and D for signed negative)
                Formula for Bytes: Integer ((n/2) + 1)) => n is number of 9s.
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert