Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comp-1, Comp-2, Comp-3, Comp-4

Status
Not open for further replies.

bojimbob

MIS
Apr 23, 1999
1
0
0
US
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.
 
comp means compress instead of 4 bytes it is stored in 8 bytes that way you can include other info to add on as indexes or scripts
 
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.
 
neildlb is right! On the pc you have also COMP-5, the Intel optimized format. Read IBM's COBOL manuals. A link is on
 
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.

Betty Scherber
Brainbench MVP for COBOL II
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top