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
 

 

Converting text to numeric format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Converting text to numeric format
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 Moderator


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

PostPosted: Sat Nov 20, 2010 12:45 am    Post subject:
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    Post subject: Reply to: Converting text to numeric format
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    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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm
No new posts How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am


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