MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

sorting after splliting into 3 files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Sep 02, 2004 2:36 am    Post subject: sorting after splliting into 3 files Reply with quote

Hi,
I have a file which i am sorting according to three fields. i am splitting this into three files. File3 will contain all the records in the input file. But i want the file3 to be sorted in another order. can we accomplish this with syncsort? fld-1 and fld-2 is ZD. fld-3 is CH.
*************************************************************
sample input
*************************************************************
fld-1---------fld-2--------------fld-3 (provided for clarity. not present in i/p)
----------------------------------------(provided for clarity. not present in i/p)
aaa-----------10--------------040401
aaa-----------11--------------040301
aaa-----------09--------------040201
bbb-----------07--------------040301
bbb-----------08--------------040201
bbb-----------08--------------040401
*************************************************************
I am sorting in this order fld-1,fld-3,fld-2

*************************************************************
expected output for file 1
*************************************************************
aaa-----------09--------------040201
aaa-----------11--------------040301
aaa-----------10--------------040401
*************************************************************
expected output for file 2
*************************************************************
bbb-----------08--------------040201
bbb-----------07--------------040301
bbb-----------08--------------040401
*************************************************************
expected output for file 3(sort only based on fld-3)
*************************************************************
aaa-----------09--------------040201
aaa-----------06--------------040201
aaa-----------11--------------040301
bbb-----------07--------------040301
bbb-----------10--------------040401
bbb-----------08--------------040401

*************************************************************
*************************************************************
For the third file i want the sorting to be done based on fld-3 only. I know it can be accomplished with another step. But i am just curious whether we can do.

I have done to part where the three files are generated. I tried writing another sort statement after the third split like this.
*************************************************************
OUTFIL FILES=03,
INCLUDE=ALL
sort (30,6,y2t,a)
*************************************************************
but it giving me syntax error. I didnt see it anywere in the manual but thought of giving it a try. Very Happy .

If it can be done through only one step, please tell me.

thanks and regards
bade_miya
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Sep 02, 2004 6:11 am    Post subject: Reply with quote

Bade_miya,

You need another step/pass to sort the 3rd file on date alone.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Thu Sep 02, 2004 8:55 am    Post subject: Reply with quote

Thanks Kolsu,
I did just that.
thanks
bade_miya.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Thu Sep 02, 2004 10:28 am    Post subject: Reply with quote

bade_miya,

If you consider 2 passes in a single step as one step then the following JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SYNCTOOL                               
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN       DD *                                           
AAA-----------10--------------040401                     
AAA-----------11--------------040301                     
AAA-----------09--------------040201                     
BBB-----------07--------------040301                     
BBB-----------08--------------040201                     
BBB-----------08--------------040401                     
//AAA      DD SYSOUT=*                                   
//BBB      DD SYSOUT=*                                   
//DATES    DD SYSOUT=*                                   
//TOOLIN   DD *                                           
  SORT FROM(IN) USING(CTL1)                               
  SORT FROM(IN) USING(CTL2)                               
//CTL1CNTL DD *                                           
  SORT FIELDS=(01,3,CH,A,                $ SORT ON FLD-1 
               15,2,CH,A,                $ SORT ON FID-2 
               31,6,Y2T,A),CENTWIN=1950  $ SORT ON FLD-3 
  OUTFIL FNAMES=AAA,INCLUDE=(1,3,CH,EQ,C'AAA')           
  OUTFIL FNAMES=BBB,INCLUDE=(1,3,CH,EQ,C'BBB')           
//CTL2CNTL DD *                                           
  SORT FIELDS=(31,6,Y2T,A),CENTWIN=1950                   
  OUTFIL FNAMES=DATES                                     
/*


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu


Last edited by kolusu on Fri Sep 03, 2004 7:04 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
asha
Beginner


Joined: 03 Sep 2004
Posts: 2
Topics: 0

PostPosted: Fri Sep 03, 2004 2:09 am    Post subject: clarify my doubt in previous job Reply with quote

hi kolusu,
i'm very new to this group and mainframes also
can u explain me these steps in this job what u have posted i,e
what do u mean by USING(CTL1) and CTL1CNTL DD * and what andCENTWIN=1950 and what about Y2T in SORTFIELDS...
can u explain me in breif........ plss
Code:

//TOOLIN   DD *                                           
  SORT FROM(IN) USING(CTL1)                               
  SORT FROM(IN) USING(CTL2)                               
//CTL1CNTL DD *                                           
  SORT FIELDS=(01,3,CH,A,                $ SORT ON FLD-1 
               15,2,CH,A,                $ SORT ON FID-2 
               31,6,Y2T,A),CENTWIN=1950  $ SORT ON FLD-3 
  OUTFIL FNAMES=AAA,INCLUDE=(1,3,CH,EQ,C'AAA')           
  OUTFIL FNAMES=BBB,INCLUDE=(1,3,CH,EQ,C'BBB')           
//CTL2CNTL DD *                                           
  SORT FIELDS=(31,6,Y2T,A),CENTWIN=1950                   
  OUTFIL FNAMES=DATES                                     
/*

Cheers
Asha
Back to top
View user's profile Send private message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Sat Sep 04, 2004 1:50 am    Post subject: Reply with quote

Hi Kolusu,
Thats great.But i have the following queries.

1)Will it cause any performance issues if i use more than one passes in a single step?

2)What is the maximum number of passes which i can give?

I am new to the concept of using more than one passes and haven't worked with synctool. I looked for some manuals for synctool but couldnt get it. Thats why i am asking. please confirm my understanding of the sort card provided by you is correct.

1) //TOOLIN DD * is the place where we specify all our passes in order.

2) SORT FROM (IN) denotes our input file dd statement.

3) USING(CTL1) denotes our control card.

4) AAA,BBB,DATES denotes our output file names.

thanks a lot
bade_miya.
Back to top
View user's profile Send private message
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Sat Sep 04, 2004 2:22 am    Post subject: Reply with quote

Hi kolusu,
I forgot to tell you that it was working fine.

Hi asha,
I can give you some inputs on the date fields in the sort card.The date field (which is the third field given in input) is of the format YYMMDD. So if we sort according to that date field, you will not get the correct value. For example if you are sorting the dates in asending order then 040904 will come before 990901. So we have to use

SORT FIELDS=(31,6,Y2T,A),CENTWIN=1950

CENTWIN means centuary window. It indicates which centuary to be assumed while sorting a date field.

Y2T specifies that YYMMDD should be converted to CCYYMMDD format before performing the sorting and it retains the YYMMDD format in output field.

please refer this link for details about the CENTWIN field.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2837

You will get more detailed help from the syncsort manuals.


thanks and regards
bade_miya.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Sep 06, 2004 7:09 am    Post subject: Reply with quote

Quote:

i'm very new to this group and mainframes also
can u explain me these steps in this job what u have posted i,e
what do u mean by USING(CTL1) and CTL1CNTL DD * and what andCENTWIN=1950 and what about Y2T in SORTFIELDS...
can u explain me in breif........ plss


Asha,

Here is a brief explanation of the job I posted above. The utility synctool is a utility from syncsort which can be used to copy, sort and create different output files.

The TOOLIN dd statement contains the control statements like copy, sort select...

XXXXCNTL dd statement contains sort control statements for a copy ,sort operations. This is similar to sysin for a SORT program.

Code:

//TOOLIN   DD *                                           
  SORT FROM(IN) USING(CTL1)                               
  SORT FROM(IN) USING(CTL2)     


In the above statements, I am requesting the pgm synctool to SORT the data in the file associated to the IN dd statement and using CTL1CNTL. This means use the CONTROL CARDS associated with CTL1CNTL dd.

CTL1CNTL is

Code:

//CTL1CNTL DD *                                           
  SORT FIELDS=(01,3,CH,A,                $ SORT ON FLD-1 
               15,2,CH,A,                $ SORT ON FID-2 
               31,6,Y2T,A),CENTWIN=1950  $ SORT ON FLD-3 
  OUTFIL FNAMES=AAA,INCLUDE=(1,3,CH,EQ,C'AAA')           
  OUTFIL FNAMES=BBB,INCLUDE=(1,3,CH,EQ,C'BBB')       


In here we are sorting on 3 fields and after the sorting is done we are splitting the file into 2 files , namely AAA and BBB. The file AAA will contail all the records which contain 'AAA' in the first 3 bytes. The file BBB will contail all the records which contain 'BBB' in the first 3 bytes.

The second SORT statement in Toolin also SORTS the data the data in the file associated to the IN dd statement and using CTL2CNTL. This means use the CONTROL CARDS associated with CTL2CNTL dd.

Code:

//CTL2CNTL DD *                                           
  SORT FIELDS=(31,6,Y2T,A),CENTWIN=1950                   
  OUTFIL FNAMES=DATES                                     
/*


If you look at the input data that bademiya provided, the date is only 6 bytes(it missing the century portion). so if we sort it exactly like that we will not the right results. so we need to expand the year portion from 2 digits to 4 digits. That is what Y2T is for. The CENTWIN option is for windowing logic. By coding centwin=1950, we are taking the year range to between 1950 and 2049. So if the years is Greater than or equal to 50 then the century will be 19 and if it is less than 50 then the year century will be 20.

After sorting we are writting the output to the DATES dd.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Sep 06, 2004 7:12 am    Post subject: Reply with quote

Bade_miya,

Quote:

1)Will it cause any performance issues if i use more than one passes in a single step?


Yes there are some performance issues if you use more than 1 pass in a single step. let us say the the first pass completes successfully and half way during the second pass, the job abends, you will lose your output from the first step also(assuming that the disp=(new,catlg,delete) on output files). Even though it looks like a single step , it is actually 2 steps stringed into a single step.

Quote:

2)What is the maximum number of passes which i can give?


That depends on your shop limit of TIOT(task input output table), which handles the no: of DD's per job. Check the 5th posting in this topic to find out the limit.

http://www.mvsforums.com/helpboards/viewtopic.php?t=2256&highlight=tiot

Quote:

I am new to the concept of using more than one passes and haven't worked with synctool. I looked for some manuals for synctool but couldnt get it.


Synctool is an unsupported/undocumented utility from synctool. To this date there is no documentation for synctool.

Quote:

please confirm my understanding of the sort card provided by you is correct.

1) //TOOLIN DD * is the place where we specify all our passes in order.

2) SORT FROM (IN) denotes our input file dd statement.

3) USING(CTL1) denotes our control card.

4) AAA,BBB,DATES denotes our output file names.


You are absolutely right.For a better understanding of the job look at my earlier post.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
bade_miya
Beginner


Joined: 10 Dec 2003
Posts: 110
Topics: 38

PostPosted: Mon Sep 06, 2004 11:21 pm    Post subject: Reply with quote

Thanks a lot kolusu.
bade_miya.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group