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 DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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