|
|
| Author |
Message |
nil_mf
New User
Joined: 06 Jun 2005 Posts: 26
|
|
|
|
Hi,
I have the below input file in mainframe.
1 CA
2 10;20;300;
3 15;25;350;99;
4
5 TX
6 76;45;65;
7
8 AZ
9 21;34;56;78;
10 23;67;99;
I need to get the output file in the below format i.e., add the text in the first line to the below lines till it encounters a blank line. Then again take the text in the first line below the blank line and add it to the following lines. This has to be repeated till the end of file.
1 CA;10;20;300;
2 CA;15;25;350;99;
3 TX;76;45;65;
4 AZ;21;34;56;78;
5 AZ;23;67;99;
I am looking for a solution that uses SORT in mainframe ie., just use only a JCL along with input and output files and no COBOL or any other programming language. Please help me
Thnx
Nil |
|
| Back to top |
|
 |
References
|
|
 |
Alain Benveniste
Active User
Joined: 14 Feb 2005 Posts: 90
|
|
| Back to top |
|
 |
Deepatinfy
New User
Joined: 06 Jun 2005 Posts: 7
|
|
|
|
Hi,
The solution provided uses ICETOOL, which is not available in our mainframe. Is this functionality possible by using SYNCSORT alone?
Thanks,
Deepesh |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Moderator
Joined: 15 Feb 2005 Posts: 4677 Location: San Jose, CA
|
|
|
|
| Note that only DFSORT supports the IFTHEN, OVERLAY and KEEPBASE functions used in the example Alain referenced. You cannot use these functions with Syncsort since it doesn't support them. |
|
| Back to top |
|
 |
Deepatinfy
New User
Joined: 06 Jun 2005 Posts: 7
|
|
|
|
| I understand that... and thanks for the reply... I just wanted to know that whether the functionality mentioned above can be implemented using SYNCSORT utility or not? If possible, then examples? Thanks again... |
|
| Back to top |
|
 |
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 |
|
| Back to top |
|
 |
|
|
|