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

Read/Decode Floating Point fields?

Status
Not open for further replies.

BobMCT

IS-IT--Management
Sep 11, 2000
756
0
0
US
We are in the midst of a data conversion from a DEC VMS system written in COBOL and most of the numerics are defined as COMP-2. We cannot seem to break the code on these fields to get their decimal equivalents. Is any one aware of or has worked with these field types in RPG? Any suggestions appreciated.
 
I am not overly familiar with COBOL, but if COMP-2 means it is compacted/compressed with 2 decimal places it might be similar to a packed field in RPG...i.e. if the number is 9 numerics long including the 2 decimals, it would be 9P 2 in RPG but only use about 4 bytes of memory to store. Of course I could also be totally off the mark...
 
not sure about cobol, but the normal format for a double precision float (which is what comp-2 is, not packed!)

SEEMMMMMMMMM

where S = sign - usually represented by an value between 0 and 9, 0-4 positive 5-9 negative.

the EE is the exponent and is usually represented as excess-n format i.e if you are using excess-500, then you must minus 500 from the exponent to get its stored form.

mmmmmm is the mantissa.

e.g in excess-50 the following value would be stored as follows

0.123455 * 10^-3

would maybe be stored as 05312345.

hope this goes to some way interpreting stored floats, although this is definitely not Cobol form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top