|
View previous topic :: View next topic
|
| Author |
Message |
jemonthomas
New User
Joined: 24 Jul 2006 Posts: 35 Location: india
|
|
|
|
Hi.
I am trying to remove column duplicates by giving sequence number and reformatting based on that.
INREC BUILD=(1,8,X,10,119,X,131:SEQNUM,3,ZD,RESTART=(1,8))
SORT FIELDS=(1,8,CH,A)
OUTREC IFTHEN=(WHEN=(133,1,ZD,EQ,1),BUILD=(1,133)),
IFTHEN=(WHEN=(133,1,ZD,NE,1),OVERLAY=(1:9X,10:10,124))
This is the code I am using.The problem is that the sequence number is not coming properly so the result is not coming as expected.Could anyone help on this? |
|
| Back to top |
|
 |
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi jemonthomas,
As per you sort card the sequence number starts from 131 position but you are validating only 133 position . Please use below mentioned sort card and validate your result.
| Code: |
INREC BUILD=(1,8,X,10,119,X,131:SEQNUM,3,ZD,START=1,INCR=1,RESTART=(1,8))
SORT FIELDS=(1,8,CH,A)
OUTREC IFTHEN=(WHEN=(131,3,ZD,EQ,1),BUILD=(1,133)),
IFTHEN=(WHEN=(131,3,ZD,NE,1),OVERLAY=(1:9X,10:10,124)) |
Thanks
Sai |
|
| Back to top |
|
 |
jemonthomas
New User
Joined: 24 Jul 2006 Posts: 35 Location: india
|
|
|
|
Hi saiprasadh
Thanks.But still I am facing the same issue.The sequence number is getting restarted from 1 eventhough the key is not changed.I need to restart the sequence number only if the key is changed which is first 8 bytes.Could you please help on this? |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you are using INREC to put your sequence number on, then it is the unsorted file that you are using - which is the reason you notice something is not working. Change it so that it is with the OUTREC,
As saiprasadh has pointed out, you are not looking at the whole seqence number. This will cause you to think that every 10th record is a "new" sequence. |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Jemonthomas,
As bill explained your INREC is processed before the SORT. So if your data is unsorted on the Key , then your Sequence number will not be correct.
Check this link which explains how DFSORT process the control cards.
DFSORT Processing
Use the following Control cards which will give you the desired results. I assumed that your input is FB 133 byte
| Code: |
//SYSIN DD *
SORT FIELDS=(1,8,CH,A),EQUALS
OUTREC IFOUTLEN=133,
IFTHEN=(WHEN=INIT,OVERLAY=(134:SEQNUM,3,ZD,RESTART=(1,8))),
IFTHEN=(WHEN=(134,3,ZD,GT,1),OVERLAY=(9X))
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|