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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please identify data format?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
US
We are trying to convert data from a DEC VMS Cobol-like language. Most of the numeric fields (i.e.:pic 999 or pic s9(7)V99) have a usage clause of COMP-2.

We cannot break the code problem trying to decipher these fields. We understand that they might be 4 or 8 byte binary and have tried just about every scheme of binary deciphering we know of.

Has anyone ever worked with the data type and if so could you please explain how it stores the data in a record?

Thanks in advance for any advice.
 
Hi Bob,

The comp-2 data type is used for internal floating point - double precision items (yuk!). I've never used it, but here's what the manual says:

They are 8 bytes long. The sign is contained in the 1st bit of the leftmost byte and the remaining 7 bits contain the exponent. The remaining 7 bytes contain the mantissa.

Sounds like scientific notation.

Good luck. Jack.

 
Slade's on the right track, except that it's scientific notation in binary, really hard to interpret. If you have access to any language that deals with the floating point types, you might want to translate it to another format with that language before you do your conversion. Betty Scherber
Brainbench MVP for COBOL II
 
Hi Bob,

If you're still interested, Robert Binder's "Application Debugging", from Prentice-Hall, ISBN 0-13-039348-7, $37, has a full discussion on how to convert Floatinf point #s (long, short, extended).

It's fairly involved. I got my copy from
Good Luck, Jack.
 
Another solution is to simply write a COBOL program on the VMS system to move the comp-2 numbers to something recognizable. This assumes that the numbers are NOT too large for the target fields.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top