IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Converting text to numeric format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Fri Nov 19, 2010 6:24 pm
Reply with quote

Hi,

I have an 80 byte FB file with the first 6 characters in a text format. I need to convert this to an edited format (TTTTT.TTTT). (The remaining characters are blanks in the file)

1.5
16.5
5
134.45
12.35

Output
00001.5000
00016.5000
00005.0000
00134.4500
00012.3500

Is this possible using any data format - I tried to use UFF but it completely removes the decimal point info.

Thanks for your help.

Thanks,
Aneesh.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Nov 20, 2010 12:45 am
Reply with quote

This is a bit tricky because you have different numbers of digits after the decimal point for different values. But here's a DFSORT job that will do what you asked for:

Code:

//S1 EXEC PGM=SORT                                         
//SYSOUT DD SYSOUT=*                                       
//SORTIN DD *                                               
1.5                                                         
16.5                                                       
5                                                           
134.45                                                     
12.35                                                       
//SORTOUT DD SYSOUT=*                                       
//SYSIN DD *                                               
  OPTION COPY                                               
  INREC IFTHEN=(WHEN=INIT,                                 
   PARSE=(%01=(ENDBEFR=C'.',FIXLEN=5),                     
               %02=(FIXLEN=4)),                             
   BUILD=(%01,UFF,EDIT=(TTTTT),C'.',%02,80:X)),             
  IFTHEN=(WHEN=INIT,                                       
    FINDREP=(STARTPOS=7,ENDPOS=10,IN=C' ',OUT=C'0'))       
/*
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Nov 20, 2010 7:57 am
Reply with quote

Thanks Frank.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top