suppose there are 5 records and all are dulicates for the key (1,16,PD). i want to reatin the fifth record. can anybody please tell me how to do this using ICETOOL?
i am sorry to say that i put my requirement wrongly. actually i got the requirement cleary after doing the above JCL. My requirement is:
Suppose a file conntais the records like this:
0000000100000002I
0000000100000002D
0000000100000002I
0000000100000002D
0000000300000004I
0000000300000004D
0000000300000004I
in this case, for the key from 1 to 16, first 4 records are duplicates and the next 3 records are duplicates. for the first key, 0000000100000002, after insert "I' there is one delete D. so insert is balanced by Delete. so i don't want these records in the O/P file.
for the next key,0000000300000004, there is an Insert I, Delete D and again Insert I, so i want to keep the last record of this key i.e. Insert.
to summarize, we can say i want to keep the last record if a key is having odd number of record. Please help me to achieve this.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You don't need two passes to do this. You can do it in one pass with a DFSORT/ICETOOL job like the following:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
0000000100000002I A
0000000100000002D B
0000000100000002I C
0000000100000002D D
0000000300000003I E
0000000300000003D F
0000000300000003I G
0000000300000005I H
0000000300000007I I
0000000300000007D J
0000000300000007I K
0000000300000008D L
0000000300000008I M
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,16,CH) LAST USING(CTL1)
/*
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:SEQNUM,8,BI,RESTART=(1,16)))
OUTFIL FNAMES=OUT,INCLUDE=(88,1,BI,EQ,B'.......1'),
BUILD=(1,80)
/*
OUT would have:
Code:
0000000300000003I G
0000000300000005I H
0000000300000007I K