Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Handling exponential formats in COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
balubhat

New User


Joined: 04 Oct 2005
Posts: 19
Location: Singapore

PostPosted: Thu Feb 10, 2011 2:58 pm    Post subject: Handling exponential formats in COBOL
Reply with quote

Hii

Please let me know how to handle exponential data format in Cobol.

I have a file of fixed length format and one of the field is amount field which is having values like 5.6843418860808015e-14 .
But it also has values like 328.88899999999995. I need to define the copybook structure for this file. How should I declare a variable to handle this type of values?


Thanks a lot in advance.
Back to top
View user's profile Send private message

Dsingh29

Active User


Joined: 16 Dec 2008
Posts: 132
Location: IBM

PostPosted: Thu Feb 10, 2011 3:20 pm    Post subject:
Reply with quote

you can use 'E' in your pic clause....

E
indicates that the following digits are the exponential for a floating point number. For example PIC '9v99999e99'.


For more information:

http://www.felgall.com/cob1.htm.


BTW..it took me just 2 mins to google. icon_smile.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Thu Feb 10, 2011 3:49 pm    Post subject:
Reply with quote

I suspect you'll have to define the field as PIC X and use program logic to determine how to handle the contents. If you use an E in the PICTURE clause, I would think records without an E in the field would cause a problem. I have not had a chance to test this, though -- when I get a chance to, Ill post the results.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Feb 11, 2011 3:33 pm    Post subject:
Reply with quote

Is the precision really used for anything? These formats most of all look like values punched from some SAS program where the programmer didn't care or weren't instructed to specify a fixed precision format.

If you have a chance to challenge the input formatting, I would start there.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us