Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sorting File Problem

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
nil_mf

New User


Joined: 06 Jun 2005
Posts: 29

PostPosted: Mon Jun 06, 2005 12:35 pm    Post subject: Sorting File Problem
Reply with quote

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
View user's profile Send private message

Alain Benveniste

New User


Joined: 14 Feb 2005
Posts: 88

PostPosted: Mon Jun 06, 2005 3:07 pm    Post subject: Re: Sorting File Problem
Reply with quote

nil,

Your solution is explained in the dfsort site :
[url]
http://www-1.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmtrck.html#d02
[/url]
Alain
Back to top
View user's profile Send private message
Deepatinfy

New User


Joined: 06 Jun 2005
Posts: 7

PostPosted: Mon Jun 06, 2005 7:40 pm    Post subject: If ICETOOL is not available
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Jun 06, 2005 9:27 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Deepatinfy

New User


Joined: 06 Jun 2005
Posts: 7

PostPosted: Tue Jun 07, 2005 7:39 am    Post subject: Re: Sorting File Problem
Reply with quote

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
View user's profile Send private message
Deepatinfy

New User


Joined: 06 Jun 2005
Posts: 7

PostPosted: Thu Jun 09, 2005 10:28 am    Post subject: Sorting File Problem - Solution
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us