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
 

 

How to convert Char to Float

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Lingam D

New User


Joined: 07 Sep 2011
Posts: 8
Location: india

PostPosted: Wed Oct 03, 2012 8:08 pm    Post subject: How to convert Char to Float
Reply with quote

Hi
I need to convert a char field to float field using sort.
My input is like

Code:
NY0.01897   color
ET1.34533   size
MW33.7899   size


I need to convert 3-12(fixed) position to float.

I tried searching in the forum but could not find it. Please provide the sort card for this.

Code'd
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Oct 03, 2012 8:16 pm    Post subject: Reply to: How to convert Char to Float
Reply with quote

if instead of the forums You had searched the manuals You could have stumbled on the FL format

but remember/consider that
FL deals only with the HEX float representation, not with the IEEE 754

better speak with the application designers to properly eviscerate the requirement
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Wed Oct 03, 2012 8:52 pm    Post subject: Reply to: How to convert Char to Float
Reply with quote

Please use the Code tags to preserve spacing of your data.

Why do you want to convert it to a "float"? I know it is the "requirement" but why does someone think using a "float" will give you anything that you can't otherwise define?

If this is coming into your system, then it might "work" for you, if you are handing it off to something else (non-mainframe) it's asking for trouble.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Oct 03, 2012 10:54 pm    Post subject:
Reply with quote

Lingam D,

TO=FL is not Supported.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Oct 03, 2012 11:02 pm    Post subject: Reply to: How to convert Char to Float
Reply with quote

icon_redface.gif

that' s what happens by looking only at one page of the manual !

the concerns about investigating the why and the format of the float representation still stands.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


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

PostPosted: Wed Oct 03, 2012 11:24 pm    Post subject: Re: How to convert Char to Float
Reply with quote

Lingam D wrote:
Hi
I need to convert a char field to float field using sort.
My input is like

Code:
NY0.01897   color
ET1.34533   size
MW33.7899   size


I need to convert 3-12(fixed) position to float.

As Dr. Sorichetti and Sr. Woodger indicate, a true floating-point number (COBOL COMP-1 or COMP-2; PL/I FLOAT) is an extremely bad choice unless you are dealing with the sorts of widely varying magnitudes to be found in scientific programming. Even on this assumption, you do not have a character representation of a floating-point number (which would look something like 1.897E-2), but what may be called a "floating decimal point"; the decimal points are not all aligned, but "float" in the field according to the number of significant digits to their left.

(I also wonder why you consider the field to be positions 3-12, when 10-12 seem invariably to be blanks.)

I recommend that you limit your efforts to aligning the decimal points or, even better, allowing the consumer of these data to do so.
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am


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