I'm just a student, okay, so be gentle, here. What the heck are these "Comp-n's", anyway, and where can I get more information about this? I've looked in my textbook, and it gives only brief lip service to the topic.
I am a mainframe programmer using COBOL II but I think it is somewhat similar.<br>
<br>
COMP stands for COMPUTATIONAL.<br>
<br>
Data length will be dependent on what you specify to be n in COMP-n (but n is not the length).<br>
<br>
COMP-1 and COMP-2 are supposed to be floating point single precision and double precision, respectively.<br>
<br>
COMP-3 is the equivalent of PACKED DECIMAL.<br>
<br>
COMP-4 is the equivalent of BINARY. <br>
I have never used Comp-1 or Comp-4. Comp-3 stands for packed decimal. The sign is dropped from each byte and placed at the end of the field. IE: F1F2F3 would be 123C. I think Comp-2 or just Comp is binary.
COMP, short for COMPUTATIONAL, is defined by the ANSI standard comittee to be the most efficient data type for math on the specific machine. The mainframe uses COMP for BINARY, which is its most efficient mode. ANSI also has extensions for COMP-n to as many others as the implementor desires. The list given by neildlb is correct for the mainframe, but since COMP-n is defined by the implementor, only the manual for your compiler, not any other reference can be guaranteed to tell you exactly what data type you might get for each one, including just plain COMP.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.