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
 
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 0 Tue Sep 26, 2017 3:35 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm

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