View previous topic :: View next topic
Author
Message
veeramanimurugesan New User Joined: 03 Nov 2009Posts: 19 Location: chennai
My input file contains the below,
Code:
Field 1 Field 2
A 1
A 1
B 1
B 2
C 1
C 1
C 2
D 1
My output file should contain,
Code:
Field 1 Field 2
A 1
A 1
D 1
I do not want records in my output which have DIFFERENT values in Field 2.
Please help on this using SORT/ICETOOL. Thanks in advance.
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
veeramanimurugesan,
How many different values does FIELD2 have? is it always just 1 and 2?
Back to top
veeramanimurugesan New User Joined: 03 Nov 2009Posts: 19 Location: chennai
Field 2 could have multiple values. 1 and 2 was just a sample to understand the requirement. Field 2 values are unpredictable. It is actually a 9 character
field.
For example,
Field 1 - Client Number
Field 2 - Account Number
A single client can have multiple accounts. If he has DIFFERENT multiple accounts, then i need to eliminate those records. If he has 2 records with same accounts, then i can have him in output. Only clients with DIFFERENT accounts need to be filtered out.
Back to top
smijoss Active User Joined: 30 Aug 2007Posts: 114 Location: pune
i got the output as u suggested, now check with ur actual data
Code:
//S020 EXEC PGM=ICETOOL
//FILE1 DD *
A 1
A 1
B 1
B 2
C 1
C 1
C 2
D 1
/*
//TEMP1 DD DSN=TEMP.TEST.DELETE,
// DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(27998,(400,100),RLSE)
//FILEOUT DD DSN=TEMP.TEST.FILEOUT,
// DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(27998,(400,100),RLSE)
//SYSOUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FILE1) TO(TEMP1) USING(CTL1)
COPY JKFROM TO(FILEOUT) USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,1,CH,A)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,1,
TRAILER3=(1,2,MIN=(6,1,ZD),MAX=(6,1,ZD)))
/*
//CTL2CNTL DD *
JOINKEYS F1=FILE1,FIELDS=(1,1,A)
JOINKEYS F2=TEMP1,FIELDS=(1,1,A),SORTED
REFORMAT FIELDS=(F1:1,6,F2:1,6)
OPTION COPY
OUTREC FIELDS=(1,6)
/*
//JNF2CNTL DD *
OMIT COND=(3,1,CH,NE,5,1,CH)
/*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
Back to top
veeramanimurugesan New User Joined: 03 Nov 2009Posts: 19 Location: chennai
Hi smijoss
Thanks for your response.
JOINKEYS wont work in my version of DFSORT. The sort version on mainframe here is Z/OS DFSORT V1R10.
Error :
COPY JKFROM TO(FILEOUT) USING(CTL2) 00240001
DFSORT CALL 0002 FOR COPY FROM JOINKEYS TO FILEOUT USING CTL2CNTL TERMINATED
OPERATION RETURN CODE: 16
Please advise.
Back to top
smijoss Active User Joined: 30 Aug 2007Posts: 114 Location: pune
Code:
//S020 EXEC PGM=ICETOOL
//FILE1 DD DSN=TEMP.TEST.INDATA,DISP=SHR
//TEMP1 DD DSN=TEMP.TEST.TEST1,DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(27998,(4000,1000),RLSE)
//CONCAT DD DSN=*.TEMP1,VOL=REF=*.TEMP1,DISP=OLD
// DD DSN=TEMP.TEST.INDATA,DISP=SHR
//FILEOUT DD DSN=TEMP.TEST.FILEOUT,
// DISP=(NEW,CATLG),UNIT=DISK,
// SPACE=(27998,(400,100),RLSE)
//SYSOUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(FILE1) TO(TEMP1) USING(CTL1)
SPLICE FROM(CONCAT) TO(FILEOUT) ON(1,1,CH) -
WITH(6,1) WITHALL USING(CTL2)
/*
//CTL1CNTL DD *
SORT FIELDS=(1,1,CH,A)
OUTFIL REMOVECC,NODETAIL,SECTIONS=(1,1,
TRAILER3=(1,1,20:MIN=(6,1,ZD),MAX=(6,1,ZD),80:X))
/*
//CTL2CNTL DD *
OUTFIL OMIT=(20,1,CH,NE,22,1,CH),OUTREC=(1,10)
/*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
INFILE :
Code:
----+----1----+----2--
**********************
A 1
A 1
B 1
B 2
C 1
C 1
C 2
D 1
Back to top
veeramanimurugesan New User Joined: 03 Nov 2009Posts: 19 Location: chennai
Thanks ! I will test this with my actual data.
It would be very helpful if you could explain the logic in TOOLIN, CTL1CNTL, CTL2CNTL control cards OR some short notes on how did you arrive at the output.
Back to top
smijoss Active User Joined: 30 Aug 2007Posts: 114 Location: pune
i knew u would ask the
TOOLIN :
you code the commands here for ICETOOL as you do in SYSIN for sortcard
to understand the purpose of CTL1CNTL -
check the output file TEMP.TEST.TEST1
download DFSORT getting started pdf, its explained very well
Back to top
Please enable JavaScript!