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
 

 

Can I add a leading Zero to fields on a file?

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

New User


Joined: 25 May 2007
Posts: 5
Location: los angeles, CA

PostPosted: Wed Jul 25, 2007 12:30 am    Post subject: Can I add a leading Zero to fields on a file?
Reply with quote

Hi,
Wondering if it is possible, using DFSORT/ICETOOL to add a leading Zero to a field?
For example, if I have a line of data that looks like:

Code:

300105  64819673.11     .00     47680690.36     .00


and I need to change the data if there is no value in the one-dollar column to contain a 0.
That is for the above data the 2 fields with .00 should be 0.00
If the data had .05, I need it to be 0.05.

The file was originally created using FOCUS, and it cannot put only 1 leading 0.
I can use the File Manager tool to do it, but was wondering if DFSORT/ICETOOL can do this.

Thank-you for your time.
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: Wed Jul 25, 2007 12:42 am    Post subject:
Reply with quote

Here's a DFSORT job that will do what you asked for.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
300105  64819673.11     .00     47680690.36     .00
300105          .11    5.00             .36   23.00
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(16,1,CH,EQ,C' '),
           OVERLAY=(16:C'0'),HIT=NEXT),
        IFTHEN=(WHEN=(24,1,CH,EQ,C' '),
           OVERLAY=(24:C'0'),HIT=NEXT),
        IFTHEN=(WHEN=(40,1,CH,EQ,C' '),
           OVERLAY=(40:C'0'),HIT=NEXT),
        IFTHEN=(WHEN=(48,1,CH,EQ,C' '),
           OVERLAY=(48:C'0'))
/*


SORTOUT will have:

Code:

300105  64819673.11    0.00     47680690.36    0.00 
300105         0.11    5.00            0.36   23.00 
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


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