|
View previous topic :: View next topic
|
| Author |
Message |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi,
I am using the below JCL to remove the duplicates on the key (1,16,PD)
| Code: |
//STEP1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//DATA DD DSN=ITM&ENV..P472.B472.ITEMUPC.EXTR.BSAM,
// DISP=SHR
//FILE1 DD DSN=ITM&ENV..P472.B472.ITEMUPC.FILE1.BSAM,
// DISP=(NEW,CATLG,CATLG),
// SPACE=(50,(11,11),RLSE),
// DCB=(RECFM=FB,LRECL=50),
// AVGREC=U,VOL=(,,,59)
//FILE2 DD DSN=ITM&ENV..P472.B472.ITEMUPC.FILE2.BSAM,
// DISP=(NEW,CATLG,CATLG),
// SPACE=(50,(12,12),RLSE),
// DCB=(RECFM=FB,LRECL=50),
// AVGREC=U,VOL=(,,,59)
//TOOLIN DD *
SELECT FROM(DATA) TO(FILE1) ON(1,16,PD) NODUPS
SORT FROM(FILE1) USING(CTL1)
//CTL1CNTL DD *
SORT FIELDS=(17,1,CH,D)
OUTFIL FNAMES=(FILE2)
//SYSOUT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=U
|
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?
Thanks
Gagan |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
| Back to top |
|
 |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Thanks a lot. It worked fine  |
|
| Back to top |
|
 |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
HI,
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.
Thanks |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
| Back to top |
|
 |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi,
Following JCL can be used for the above requirement:
| Code: |
//ICETL01 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//IN DD DSN=OPERA12.INFILE,
// DISP=SHR
//TEMP DD DSN=&&TEMP1,UNIT=SYSDA,SPACE=(CYL,(100,100),RLSE),
// DISP=(MOD,PASS)
//FILE DD DSN=OPERA12.FILE1,DISP=SHR
//TOOLIN DD *
SELECT FROM(IN) TO(TEMP) ON(1,16,PD) LAST USING(SEQN)
COPY FROM(TEMP) TO(FILE) USING(INCL)
/*
//SEQNCNTL DD *
INREC BUILD=(1,50,51:SEQNUM,10,ZD,RESTART=(1,16))
SORT FIELDS=COPY
OUTFIL FNAMES=TEMP,
BUILD=(1,60,61:51,10,ZD,MOD,+02,TO=ZD,LENGTH=10,80:X)
/*
//INCLCNTL DD *
INCLUDE COND=(61,10,ZD,NE,+0)
SORT FIELDS=(17,01,CH,D)
OUTREC BUILD=(1,50,80:X)
/*
|
Thanks
Gagan |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

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
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|