DFSORT - How to replace a file prefix with another String



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

DFSORT - How to replace a file prefix with another String

Postby Natasha » Tue Jan 13, 2015 2:40 am

Hello,

This is quite simple to code programatically (in Cobol, rexx ect), but I wonder if it can be done through DFSORT ?

I have a file containing a file name (up to 44 bytes), followed by a 8 byte string (always in pos 46). I want to replace the 'high level qualifier' in position 1, with the 8 byte string, for example.

Input
PROD.MY.TEST.FILE                 TEST
TEST.ANOTHER.FILE.OF.MINE         DEV


Output
TEST.MY.TEST.FILE
DEV.ANOTHER.FILE.OF.MINE



I've looked at the DFSORT manual, PARSE, OVERLAY, FINDREP, but I can't quite get this to work. I could write some rexx to do this, but is it possible in DFSORT ?

Thank you.
Natasha
 
Posts: 2
Joined: Tue Jan 13, 2015 2:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT - How to replace a file prefix with another Strin

Postby BillyBoyo » Tue Jan 13, 2015 3:56 am

Yes, it can be done. PARSE is what you want. Can you show the code you tried for PARSE so we can fix it up?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: DFSORT - How to replace a file prefix with another Strin

Postby Natasha » Wed Jan 14, 2015 1:10 am

Hello,

I finally got it to work although it might not be the most elegant solution. I was attempting to code the PARSE, SQZ and BUILD all within the OUTREC command, until I realised that I could use INREC and OUTREC.
I like to use utilities whenever possible so I was determined to get it to work.

  OPTION COPY                                                 
  INREC  PARSE=(%01=(STARTAT=C'.',ENDAT=C' ',FIXLEN=44)),     
      BUILD=(46,8,%01)                                       
  OUTREC BUILD=(1,60,SQZ=(SHIFT=LEFT))                         
  END         


Thanks
Natasha
 
Posts: 2
Joined: Tue Jan 13, 2015 2:25 am
Has thanked: 0 time
Been thanked: 0 time

Re: DFSORT - How to replace a file prefix with another Strin

Postby BillyBoyo » Wed Jan 14, 2015 6:18 pm

That's a serviceable solution.

You can two IFTHEN=(WHEN=INIT prefixing the PARSE and the two BUILDs to get them all on INREC.

I'm not sure why you have 1,60. It only needs to be 1,50. Note that you may be building a DSN longer than is allowed. You can check for that if you feel it may be an issue with your particular data.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post