Posted: Fri Jun 10, 2005 11:53 am Post subject: Comp fields storage in memory

Hi all,

If i have a field PIC 9(8) comp .... having value '4020722' , how will it be stored in memory..... will it be in its binary form i.e. 1111 1010 1011 0011 1110 0010 or something else.
I need to write a Conversion Program in C++ that will convert an ASCII number to EBCDIC comp value. Can someone help me with this.
Thanks in advance.

Posted: Fri Jun 10, 2005 5:30 pm Post subject: Re: Comp fields storage in memory

Hi Talent.......

What you guessed is correct, It stores in Binary only.

Actually, BINARY, COMP, and COMP-4 are synonyms on all platforms.
Binary format numbers occupy 2, 4, or 8 bytes of storage. If the PICTURE clause specifies that the item is signed, the leftmost bit is used as the operational sign. A binary number with a PICTURE description of four or fewer decimal digits occupies 2 bytes; five to nine decimal digits, 4 bytes; and 10 to 18 decimal digits, 8 bytes. Binary items with nine or more digits require more handling by the
compiler.

Posted: Fri Jun 10, 2005 5:34 pm Post subject: Re: Comp fields storage in memory

Hi Talent.......

What you guessed is correct, It stores in Binary only.

Actually, BINARY, COMP, and COMP-4 are synonyms on all platforms.
Binary format numbers occupy 2, 4, or 8 bytes of storage. If the PICTURE clause specifies that the item is signed, the leftmost bit is used as the operational sign. A binary number with a PICTURE description of four or fewer decimal digits occupies 2 bytes; five to nine decimal digits, 4 bytes; and 10 to 18 decimal digits, 8 bytes. Binary items with nine or more digits require more handling by the
compiler.