Deepatinfy
New User
Joined: 06 Jun 2005 Posts: 7
|
|
|
|
Please post your abservations on the following method...
//STEP010 EXEC PGM=SYNCTOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
CA
10;20;300;
15;25;350;99;
TX
76;45;65;
AZ
21;34;56;78;
23;67;99;
//TEMP1 DD DSN=&TEMP1,DISP=(,PASS)
//TEMP2 DD DSN=&TEMP2,DISP=(,PASS)
//TEMP3 DD DSN=&TEMP3,DISP=(,PASS)
//TEMP4 DD DSN=&TEMP4,DISP=(,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) USING(CTL1)
COPY FROM(TEMP2) USING(CTL2)
COPY FROM(TEMP1) USING(CTL3)
COPY FROM(TEMP3) TO(OUT) USING(CTL4)
//CTL1CNTL DD *
SORT FIELDS=COPY
INREC FIELDS=(1,30,2X,SEQNUM,3,ZD,80:X)
OUTFIL INCLUDE=(3,3,CH,EQ,C' '),
OUTREC=(1,35,SEQNUM,3,ZD,80:X),
FNAMES=TEMP1
OUTFIL INCLUDE=(3,3,CH,NE,C' '),
OUTREC=(1,40,SEQNUM,3,ZD,80:X),
FNAMES=TEMP2
//CTL2CNTL DD *
SORT FIELDS=COPY
OUTFIL OUTREC=(1,45,33,3,ZD,SUB,41,3,ZD,EDIT=(TTT),80:X),
FNAMES=TEMP3
//CTL3CNTL DD *
SORT FIELDS=COPY
OUTFIL OUTREC=(13X,C' C''',36,3,C''',C''',1,2,C''',',80:X),
FNAMES=TEMP4
//CTL4CNTL DD *
SORT FIELDS=COPY
INREC FIELDS=(46,3,CHANGE=(02,C' ',C' ',
// DD DSN=&TEMP4,VOL=REF=*.TEMP4,DISP=OLD
// DD *
C' ',C' '),
NOMATCH=(1,2),C';',1,32,80:X)
/*
CTL1CNTL - will seperate out the 'state' records CA,TX,AZ etc and the rest of the records. Before seggregating it will put running sequence number from the position 33-35.
It will also add running sequence number from 36-39 on state records and 41-43 on other records.
At the end of this the input data will be split like
----+----1----+----2----+----3----+----4----+
CA 001001
TX 004002
AZ 006003
and
----+----1----+----2----+----3----+----4----+
10;20;300; 002 001
15;25;350;99; 003 002
76;45;65; 005 003
21;34;56;78; 007 004
23;67;99; 008 005
CTL2CNTL - this will take the 'other' records and will subtract the sequence numbers that you see above. At the end of this, you will have
----+----1----+----2----+----3----+----4----+----
10;20;300; 002 001 001
15;25;350;99; 003 002 001
76;45;65; 005 003 002
21;34;56;78; 007 004 003
23;67;99; 008 005 003
CTL3CNTL will read the TEMP1 file and create a DYNAMIC sort card
Input
----+----1----+----2----+----3----+----4----+
CA 001001
TX 004002
AZ 006003
Output
C'001',C'CA',
C'002',C'TX',
C'003',C'AZ',
Finally CTL4CNTL will use the output of CTL3CNTL - construct a sort card like
SORT FIELDS=COPY
INREC FIELDS=(46,3,CHANGE=(02,C' ',C' ',
C'001',C'CA',
C'002',C'TX',
C'003',C'AZ',
C' ',C' '),
NOMATCH=(1,2),1,32,80:X)
Input will be TEMP2
----+----1----+----2----+----3----+----4----+----
10;20;300; 002 001 001
15;25;350;99; 003 002 001
76;45;65; 005 003 002
21;34;56;78; 007 004 003
23;67;99; 008 005 003
This dynamic sort card will read the positions 46 to 48 and will insert the state into first two bytes - if there is 001 then CA, if 002 then TX etc.., and bingo your output!
******************************** Top of Dat
CA;10;20;300;
CA;15;25;350;99;
TX;76;45;65;
AZ;21;34;56;78;
AZ;23;67;99;
******************************** Bottom of
Thanks,
Deepesh |
|