Phantom Data Mgmt Moderator

Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Mon Dec 27, 2004 5:03 am Post subject: |
|
|
petluri,
Try this Synctool job.
Code: |
//R010 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPUT1 DD *
A20B20C20D20
/*
//INPUT2 DD *
A1112345
A1727574
A1927574
B1123456
B1223456
C1145678
C1245678
C1345678
C1445678
D1167888
/*
//OUTPUT1 DD SYSOUT=*
//OUTPUT2 DD SYSOUT=*
//OUTPUT3 DD SYSOUT=*
//OUTPUT4 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INPUT1) USING(CTL1)
COPY FROM(INPUT2) USING(CTL2)
/*
//CTL2CNTL DD DSN=&&TEMP1,DISP=(,PASS)
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,
OUTREC=(2X,C'OUTFIL FNAMES=OUTPUT1,',
C'INCLUDE=(1,3,CH,LE,C''',1,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT2,',
C'INCLUDE=(1,3,CH,GT,C''',1,3,C''',AND,',
C'1,3,CH,LE,C''',4,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT3,',
C'INCLUDE=(1,3,CH,GT,C''',4,3,C''',AND,',
C'1,3,CH,LE,C''',7,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT4,',
C'INCLUDE=(1,3,CH,GT,C''',7,3,C''',AND,',
C'1,3,CH,LE,C''',10,3,C''')',80:X)
/*
|
Here is a brief description of what the job does.
1. First, I assumed that you actually wanted the conditions like this:
Code: |
a. Write to Output1 if Key in file 2 is LE (Less than or Equal to) Key in position 1 thru 3 of Input file 1.
b. Write to Output2 if Key is file 2 is GT first Key (file 1) and LE Second Key (file 1) and so on.
|
Is this assumption right ? B'cas you never pointed out the GT condition in your post. You just asked me to compare the Keys in file 2 against the Second Key in file 1 (Pos: 4 thru 6). Anyway you can easily change my job if this assumption is wrong.
Description:
1. Take as input File 1 and create a DYNAMIC Sort Control Card CTL2CNTL as shown below.
Code: |
OUTFIL FNAMES=OUTPUT1,INCLUDE=(1,3,CH,LE,C'A20')
OUTFIL FNAMES=OUTPUT2,INCLUDE=(1,3,CH,GT,C'A20',AND,1,3,CH,LE,C'B20')
OUTFIL FNAMES=OUTPUT3,INCLUDE=(1,3,CH,GT,C'B20',AND,1,3,CH,LE,C'C20')
OUTFIL FNAMES=OUTPUT4,INCLUDE=(1,3,CH,GT,C'C20',AND,1,3,CH,LE,C'D20')
|
2. Now read the Input file 2 and split the records into 4 different output file using the conditions listed in the Control card - CTL2CNTL.
Hope I'm clear.
Now, if you want your output files 2, 3, 4 to be cumulative as shown below.
Output File 2 = Output File 1 + records for file 2
Output file 3 = Output File 1 + Output File 2 + records for file 3
Output file 4 = Output File 1 + Output File 2 + Output File 3 + records for file 4 then use this job.
Code: |
//R010 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPUT1 DD *
A20B20C20D20
/*
//INPUT2 DD *
A1112345
A1727574
A1927574
B1123456
B1223456
C1145678
C1245678
C1345678
C1445678
D1167888
/*
//OUTPUT1 DD SYSOUT=*
//OUTPUT2 DD SYSOUT=*
//OUTPUT3 DD SYSOUT=*
//OUTPUT4 DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INPUT1) USING(CTL1)
COPY FROM(INPUT2) USING(CTL2)
/*
//CTL2CNTL DD DSN=&&TEMP1,DISP=(,PASS)
//CTL1CNTL DD *
OUTFIL FNAMES=CTL2CNTL,
OUTREC=(2X,C'OUTFIL FNAMES=OUTPUT1,',
C'INCLUDE=(1,3,CH,LE,C''',1,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT2,',
C'INCLUDE=(1,3,CH,LE,C''',4,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT3,',
C'INCLUDE=(1,3,CH,LE,C''',7,3,C''')',80:X,/,
2X,C'OUTFIL FNAMES=OUTPUT4,',
C'INCLUDE=(1,3,CH,LE,C''',10,3,C''')',80:X)
/*
|
The CTL2CNTL will be generated as shown below.
Code: |
OUTFIL FNAMES=OUTPUT1,INCLUDE=(1,3,CH,LE,C'A20')
OUTFIL FNAMES=OUTPUT2,INCLUDE=(1,3,CH,LE,C'B20')
OUTFIL FNAMES=OUTPUT3,INCLUDE=(1,3,CH,LE,C'C20')
OUTFIL FNAMES=OUTPUT4,INCLUDE=(1,3,CH,LE,C'D20')
|
Hope this helps,
Thanks,
Phantom |
|