Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Functionality for converting exponential to Numerix format

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

New User


Joined: 05 Sep 2008
Posts: 15
Location: Hyderabad

PostPosted: Tue Jun 25, 2013 2:57 pm    Post subject: Functionality for converting exponential to Numerix format
Reply with quote

Hi All,

Could some one help me with any functionality for converting exponential to Numerix format.

I am getting the input like -1.302e+06. If I handle it throw numeric data types, the job is failing with S0C-7 error.

could you please let me know the COBOL equivalent declartion for the above exponential values.

Thanks in advance
Pavan
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 25, 2013 3:09 pm    Post subject:
Reply with quote

Can you show input and output datatype and move statement with code tags on?
Back to top
View user's profile Send private message
pavanchandana

New User


Joined: 05 Sep 2008
Posts: 15
Location: Hyderabad

PostPosted: Tue Jun 25, 2013 3:14 pm    Post subject: Reply to: Functionality for converting exponential to Numeri
Reply with quote

I have coded the logic to handle -1.30200 but today I got the value as -1.302e+06 in my input. I want to handle these exceptional cases as well. I did some research on this and found that we can declare the data type with E but I feel it wont work with the actual numeric values which are not having e+ in it.

These values are passed thru XML

Please help me
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jun 25, 2013 3:46 pm    Post subject: Re: Functionality for converting exponential to Numerix form
Reply with quote

pavanchandana wrote:
Hi All,

Could some one help me with any functionality for converting exponential to Numerix format.

I am getting the input like -1.302e+06. If I handle it throw numeric data types, the job is failing with S0C-7 error.

could you please let me know the COBOL equivalent declartion for the above exponential values.

Thanks in advance
Pavan

Read about external floating-point items.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7907
Location: Bellevue, IA

PostPosted: Tue Jun 25, 2013 4:47 pm    Post subject:
Reply with quote

From what you have posted so far, your question cannot be answered. COBOL has two external floating point data types, COMP-1 and COMP-2, and which one you use depends upon the input data.

However, I suspect your problem is not with external floating point values, but with input data coming in as USAGE DISPLAY but having the exponent in the display format. What is the difference? -1.3206e+06 is in display format; the COMP-1 equivalent would be X'C613E048'. If this is the case, you will need to write your own code to determine how to computer the value including the exponent. Or, if you do not need the numeric value, just treat the data as alphanumeric text (PIC X).
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Jun 25, 2013 6:51 pm    Post subject:
Reply with quote

Robert Sample wrote:
From what you have posted so far, your question cannot be answered. COBOL has two external floating point data types, COMP-1 and COMP-2, and which one you use depends upon the input data.

I think that that may not be the case.

COMP-1 and COMP-2 are internal floating-point formats. An external floating point number would have usage DISPLAY and picture -mantissaE+exponent.

Re-reading this thread, I believe that Pavan's problem is that the generator of the XML (Excel, perhaps) is not providing a consistent format for the data. As you say, he will have have to write some code to determine the format and handle it accordingly.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Tue Jun 25, 2013 7:04 pm    Post subject:
Reply with quote

It is sad but true that inconsistencies are always been imposed to be fixed in MF icon_sad.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7907
Location: Bellevue, IA

PostPosted: Tue Jun 25, 2013 7:04 pm    Post subject:
Reply with quote

Yes, I got internal and external mixed up. Trying too much multitasking, I suspect.

pavanchandana, you need to review the incoming data. If it is all one format (-1.3206e+06 for example) then you can handle the data via a PIC clause in COBOL. If there are multiple formats (1.27e+03 as well as -1.3206e+06 for example -- where the data values are not byte-for-byte aligned) then you will need to either (a) get the source to send you data in only one format, or (b) write your own code to determine the numeric value of the data you are getting. Oh, and your title is very misleading -- exponential data is numeric, just not numeric in an easily used format.
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 Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us