View previous topic :: View next topic
|
Author |
Message |
kpmdreamz
New User
Joined: 05 Apr 2007 Posts: 4 Location: Bangalore
|
|
|
|
Hi,
I have a file in which the header record is incorrect (It should have low values from col 2 to 11). I want a sort step to introduce low values from col 2 to 11 i.e. 9 bytes.
How to do it.
I have tried
Code: |
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(2:X'000000000000000000'))
|
But this changes all records. How to apply it to only the header record. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Yes it will change all the records..as you are doing overlay in WHEN=INIT
which applies to all records.
can you post sample input file. How header is identified? using some record type indicator? or positioned as first record? |
|
Back to top |
|
|
kpmdreamz
New User
Joined: 05 Apr 2007 Posts: 4 Location: Bangalore
|
|
|
|
Thanks for the reply Sambhaji,
My file has only one header positioned as first record (doesn't have any rec type indicator) |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Assuming your LRECL is 80
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
IFTHEN=(WHEN=(81,8,ZD,EQ,1),OVERLAY=(2:X'000000000000000000'))
OUTREC BUILD=(1,80)
/*
|
|
|
Back to top |
|
|
kpmdreamz
New User
Joined: 05 Apr 2007 Posts: 4 Location: Bangalore
|
|
|
|
Thanks a lot.
It worked great.
Thanks for intoducing the concept of SEQNUM. I checked the manual its great stuff. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Note that instead of 2:X'000000000000000000' you can use 2:9Z or 2:9X'00'. |
|
Back to top |
|
|
kpmdreamz
New User
Joined: 05 Apr 2007 Posts: 4 Location: Bangalore
|
|
|
|
Thanks Frank - Saw it after a long time
I had indeed used 2:9x'00'. But i did not know that i could use 2:9Z |
|
Back to top |
|
|
|