hex to floating point to decimal from file input

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
drstrong
Member
Posts: 2
Joined: Thu Jul 11, 2013 11:02 pm

hex to floating point to decimal from file input

Post by drstrong » Thu Jul 11, 2013 11:12 pm

I am reading a file on z/os using LE Cobol. One of the fields in a record has the hex value '401999999999999A'. This is the hex representation of a floating point, double precision value that is equal to decimal 6.45. Is there a way to read that field into my program and produce that decimal value?

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Jul 12, 2013 12:59 am

Are you sure this is an FP value? It looks like a signed zoned-decimal.
Have a good one

drstrong
Member
Posts: 2
Joined: Thu Jul 11, 2013 11:02 pm

Post by drstrong » Fri Jul 12, 2013 1:21 am

It's definitely FP. The client providing the data gave me the 'answer' to that field and when I plug in 6.4 into one of the many online IEEE-754 converters, it comes up with that hex value.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Fri Jul 12, 2013 2:33 am

Suggest you follow the IBM Manuals link at the top of the page.

Then search in the Enterprise COBOL Language Reference.

There is a Lot of ino concerning Floating Point.
Have a good one

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others