View previous topic :: View next topic
Author
Message
Anu Vijayaraghavan New User Joined: 13 Feb 2008Posts: 16 Location: Chennai
file details:
master file:
LRECL = 420
key start position:9
key length :12
reference file:
LRECL = 86
key start position:2
key length :12
file characteristics:
both master and reference file have a common key.
master file may contain duplicates.
reference file will NOT contain duplicates.
requirement:
ICETOOL must be used
All the records of the master file should be written to the output file
If a Key is found in both master and reference file then the fields 75 to 80 in reference file should be moved to the fields 385-390 in the output file.
if a match for a record in master file is NOT found in the reference file then the fields 385-390 of the output file should contain the original data that was present in the master file
Back to top
Anu Vijayaraghavan New User Joined: 13 Feb 2008Posts: 16 Location: Chennai
Hi all,
I went through some of the solutions provided in this forum and wrote the following sort code to accomplish my requirements. This code worked fine for me.
Code:
//IN1 DD DSN=IN1,DISP=SHR
//IN2 DD DSN=IN2,DISP=SHR
//REF DD DSN=REF,DISP=SHR
//MASTR DD DSN=&&MASTR,DISP=(MOD,PASS),SPACE=(CYL,(9,9),RLSE)
//T2 DD DSN=&&T2,DISP=(MOD,PASS),SPACE=(CYL,(9,9),RLSE)
//MERGE1 DD DSN=MERGE1,
// DISP=(OLD,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(25,10),RLSE),
// LRECL=422,RECFM=FB
//OUTFILE DD DSN=OUTFILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(25,10),RLSE),
// LRECL=420,RECFM=FB
//TOOLIN DD *
COPY FROM(IN1) TO(MASTR)
COPY FROM(IN2) TO(MASTR)
COPY FROM(REF) TO(T2) USING(CTL1)
COPY FROM(MASTR) TO(T2) USING(CTL2)
COPY FROM(T2) TO(MERGE1)
SPLICE FROM(MERGE1) TO(OUTFILE) ON(9,12,CH) WITHALL
WITH(1,384) WITH(391,30) WITH(421,1) KEEPNODUPS USING(CTL3)
//CTL1CNTL DD *
OUTFIL FNAMES=T2,
BUILD=(1:1,8,9:2,12,21:21,66,298X,385:75,6,30X,421:C'RR')
//CTL2CNTL DD *
SORT FIELDS=(9,12,CH,A)
OUTFIL FNAMES=T2,BUILD=(1:1,420,421:C'MM')
//CTL3CNTL DD *
OUTFIL FNAMES=OUTFILE,
INCLUDE=(421,2,CH,NE,C'RR'),
BUILD=(1:1,420)
Back to top
Skolusu Senior Member Joined: 07 Dec 2007Posts: 2205 Location: San Jose
Anu Vijayaraghavan,
You really don't need that many passes of data. The following DFSORT/ICETOOL JCL will give you the desired results
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//MASTER DD DSN=your 420 byte master file,DISP=SHR
//REFER DD DSN=your 86 byte reference file,DISP=SHR
//TEMP DD DSN=&&TEMP,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(REFER) USING(CTL1)
COPY FROM(MASTER) USING(CTL2)
SORT FROM(TEMP) USING(CTL3)
//CTL1CNTL DD *
OUTFIL FNAMES=TEMP,BUILD=(9:2,12,385:75,6,421:C'1')
//CTL2CNTL DD *
OUTFIL FNAMES=TEMP,OVERLAY=(421:C'2')
//CTL3CNTL DD *
SORT FIELDS=(9,12,CH,A),EQUALS
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(423:SEQNUM,8,ZD,RESTART=(9,12))),
IFTHEN=(WHEN=GROUP,BEGIN=(423,8,ZD,EQ,1),PUSH=(422:421,1,431:385,6))
OUTFIL FNAMES=OUT,INCLUDE=(421,2,ZD,GE,21),IFOUTLEN=420,
IFTHEN=(WHEN=(421,2,ZD,EQ,21),OVERLAY=(385:431,6))
/*
Back to top
Please enable JavaScript!