Hi Kolusu,
I tried your code and its pulling all the records into output file, irrespective of the fact whether the key has same first name or different first name, same DOB or different DOB.
Just a recap of my requirements, i need those records whose key has different first name and different DOB among its set of records.
Please find my below testing of your code.
Input file :
Key : Starting position : 3 , Length : 11
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
CO1 PNX2010400708380400
CS1 02011400002734910900001
PA1 IL-CO-359002043-00
PA1 NI-22-7083804-01
PA1 RI-11-0303460-01-E
CO21 PNX2071700708382500
CS21 07024350052238821000001
PA21 IL-CO-334002568-00
PA21 NI-22-7083825-01
CO41 PNX2010400143858100
PA41 IL-CO-359002207-00
PA41 NI-22-1438581-01
PA41 NI-22-7083847-01
PD41 002487161_00000000000056362851_S260_00008444
PA61 IL-CO-359001976-00
PA61 NI-22-7083871-01
PD61 002488020_00000000000056436101_S260_00008444
First name : Starting position : 198 , Length : 35
4----+----5----+----6----+----7----+----8----+----9----+----0----+----1-
***************************** Top of Data ******************************
GRAHAM
GRAHAM
GRAHAM
GRAHAM
GRAHAM
LYLE
834495305 LYLE
LYLE
LYLEE
LAWRENCE
LAWRENCE A
LAWRENCE
LAWRENCE
7083847 LAWRENCE
JOE
JOEY
7083871 JOE
DOB : Starting position : 293, Length : 10
----+----4----+----5----+----6----+----7----+----8----+----9----+----0--
***************************** Top of Data ******************************
BARGER 1939-05-29
BARGER 1939-05-29
BARGER 1939-05-29
BARGER 1939-05-29
BARGER 1939-05-29
PHIPPS 1935-12-22
PHIPPS 1935-12-22
PHIPPS 1935-12-22
PHIPPS 1945-12-22
CORIAIN 1934-04-11
CORIAIN 1934-04-11
CORIAIN 1934-04-11
CORIAIN 1934-04-11
CORIAIN 1934-04-11
SHEARRIN 1931-03-19
SHEARRIN 1931-04-19
SHEARRIN 1931-03-19
JCL
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DISP=SHR,DSN=F6435T.ALLSRC.BOB.D140218.SAMPLE
//T1 DD DSN=F6435T.ALLSRC.BOB.D140218.ICE.TEMP,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=11,RECFM=FB,BLKSIZE=0),
// SPACE=(CYL,(4000,4000),RLSE)
//OUT DD DSN=F6435T.ALLSRC.BOB.D140218.ICE,
// DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=302,RECFM=FB,BLKSIZE=0),
// SPACE=(CYL,(4000,4000),RLSE)
//TOOLIN DD *
SELECT FROM(IN) TO(T1) ON(03,11,UFF) ALLDUPS USING(CTL1)
COPY JKFROM TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC BUILD=(3,11,198,35,293,10)
OPTION DYNALLOC=(SYSALLDA,50)
SORT FIELDS=(01,011,UFF,A,12,45,CH,A)
SUM FIELDS=NONE
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,BUILD=(11X),
SECTIONS=(1,11,TRAILER3=(1,11))
/*
//CTL2CNTL DD *
OPTION DYNALLOC=(SYSALLDA,50)
JOINKEYS F1=IN,FIELDS=(3,11,A)
JOINKEYS F2=T1,FIELDS=(1,11,A),SORTED,NOSEQCK
REFORMAT FIELDS=(F1:1,302)
/*
Output file : T1
BROWSE F6435T.ALLSRC.BOB.D140218.ICE.TEMP Line 00000000 Col 001 011
Command ===> Scroll ===> CSR
********************************* Top of Data **********************************
1
21
41
61
******************************** Bottom of Data ********************************
Output file : OUT
BROWSE F6435T.ALLSRC.BOB.D140218.ICE Line 00000000 Col 0
Command ===> Scroll ===
********************************* Top of Data ***************************
CO1 PNX2010400708380400
CS1 02011400002734910900001
PA1 IL-CO-359002043-00
PA1 NI-22-7083804-01
PA1 RI-11-0303460-01-E
CO21 PNX2071700708382500
CS21 07024350052238821000001
PA21 IL-CO-334002568-00
PA21 NI-22-7083825-01
CO41 PNX2010400143858100
PA41 IL-CO-359002207-00
PA41 NI-22-1438581-01
PA41 NI-22-7083847-01
PD41 002487161_00000000000056362851_S260_00008444
PA61 IL-CO-359001976-00
PA61 NI-22-7083871-01
PD61 002488020_00000000000056436101_S260_00008444
To sum up the testing :
Input file has 4 keys : 1 , 21 , 41 , 61
Key 1 : Same First name (GRAHAM) and Same DOB (1939-05-29) for all records - Should not be written into output file
Key 21 : Different First name (LYLE & LYLEE) and Different DOB (1935-12-22 & 1945-12-22) - Should be wrritten into output file
Key 41 : Different First name (LAWRENCE & LAWRENCE A) and same DOB (1934-04-11) - Should not be wrriten into output file
Key 61 : Different First name (JOE & JOEY) and Different DOB (1931-03-19 & 1931-04-19) - Should be written into output file.
But in my testing all records form input file has been written into output file.
But my expected test cases were as below :
When a record has both ( as that of Key 21 and 61), different first name and different DOB from other set of records belonging to same key , it has to be written in output file.
When a records has different first name but same DOB (Key 41) or vice versa (Same first name and different DOB), then it has to be skipped and shouldnt be written into output file.
Hope am clear, a bit complex requirement hoping to have a solution from you.
Thanks in advance and being patient in giving your solution.