Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Sep 14, 2005 7:16 am Post subject:
Suresh05,
This could be accomplished using Syncsort. But For this I need to know the following.
1. LRECL & RECFM of your input files.
2. Is there any possibility of duplicates (key) in any of the files ?
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Wed Sep 14, 2005 9:34 am Post subject:
Suresh05,
There is little problem with your S9(15)V9(03) Comp-3. Syncsort does not support more than 8 digits in Packed Decimal. I tested my code using ZD instead of PD. You may need to tailor the code appropriately.
Code:
//R010 EXEC PGM=SYNCTOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INPUT1 DD *
12345 11111 000000000E 000000000A 000000000F 000000000J
12345 22222 000000000F 000000000B 000000000G 000000000G
12340 33333 000000000G 000000000C 000000000H 000000000I
12340 44444 000000000H 000000000D 000000000I 000000000I
/*
//INPUT2 DD *
000000000A 000000000E 11111 000000000A 000000000A 000000000B
000000000E 000000000B 44444 000000000B 000000000A 000000000D
/*
//TEMP1 DD DSN=&&T1,DISP=(,PASS)
//TEMP2 DD DSN=&&T2,DISP=(,PASS)
//CONCAT DD DSN=&&T1,DISP=SHR,VOL=REF=*.TEMP1
// DD DSN=&&T2,DISP=SHR,VOL=REF=*.TEMP2
//OUTPUT1 DD DSN=&&O1,DISP=(,PASS)
//OUTPUT2 DD DSN=&&O2,DISP=(,PASS)
//OUTCON DD DSN=&&O1,DISP=SHR,VOL=REF=*.OUTPUT1
// DD DSN=&&O2,DISP=SHR,VOL=REF=*.OUTPUT2
//OUTPUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(INPUT1) TO(TEMP1) USING(CTL1)
COPY FROM(INPUT2) TO(TEMP2) USING(CTL2)
SORT FROM(CONCAT) USING(CTL3)
COPY FROM(OUTCON) TO(OUTPUT)
/*
//CTL1CNTL DD *
INREC FIELDS=(1,60, * COPY FULL DATA *
60Z, * 60 LOW-VALUES *
130:X) * BLANK TILL 110 *
/*
//CTL2CNTL DD *
INREC FIELDS=(6X, * 6 BLANKS *
23,5, * KEY FIELD @ COL 7 *
60:X, * BLANK TILL 40 *
1,10, * FIELD 1 *
X,
12,10, * FIELD 2 *
X,
29,10, * FIELD 4 *
X,
40,10, * FIELD 5 *
X,
51,10, * FIELD 6 *
130:X) * BLANK TILL 130 *
/*
//CTL3CNTL DD *
INREC FIELDS=(1,130, * COPY FULL DATA *
C'1') * SEQ NUM TO FIND MATCH *
SORT FIELDS=(7,5,ZD,A) * SORT ON KEY FIELD *
SUM FIELDS=(61,8,BI,69,2,BI, * BINARY SUM ON FIELD1 *
72,8,BI,80,2,BI, * BINARY SUM ON FIELD2 *
83,8,BI,91,2,BI, * BINARY SUM ON FIELD4 *
94,8,BI,102,2,BI, * BINARY SUM ON FIELD5 *
105,8,BI,113,2,BI, * BINARY SUM ON FIELD6 *
131,1,ZD) * SUM ON SEQ NUMBER *
OUTFIL FNAMES=OUTPUT1,
INCLUDE=(131,1,CH,EQ,C'2',AND, * MATCHING RECORDS *
46,10,ZD,LT,0), * FILE 1 - FIELD 6 < 0 *
OUTREC=(1,12,
13,10,ZD,SUB,61,10,ZD,ZD,LENGTH=10, * F1-3 - F2-1 *
X,
24,10,ZD,ADD,72,10,ZD,ZD,LENGTH=10, * F1-4 + F2-2 *
X,
35,10, * F1-5 *
X,
46,10,ZD,ADD,94,10,ZD,ZD,LENGTH=10) * F1-6 + F2-5 *
OUTFIL FNAMES=OUTPUT2,
INCLUDE=(131,1,CH,EQ,C'2',AND, * MATCHING RECORDS *
46,10,ZD,GE,0), * FILE 1 - FIELD 6 >= 0 *
OUTREC=(1,12,
13,10,ZD,SUB,61,10,ZD,ZD,LENGTH=10, * F2-1 - F1-3 *
X,
24,10,ZD,ADD,72,10,ZD,ZD,LENGTH=10, * F1-4 + F2-2 *
X,
35,10, * F1-5 *
X,
46,10,ZD,ADD,105,10,ZD,ZD,LENGTH=10) * F1-6 + F2-6 *
/*
Syncsort only supports 8 bytes for packed decimal(comp-3) for arthimetic operations.
The following JCL will give you the desired results. you need syncsort for z/os 1.2 for the join function to work. I don't have time to explain as to how the job works.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum