Posted: Thu Sep 02, 2004 2:36 am Post subject: sorting after splliting into 3 files
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. .
If it can be done through only one step, please tell me.
Posted: Fri Sep 03, 2004 2:09 am Post subject: clarify my doubt in previous job
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
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.
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.
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Mon Sep 06, 2004 7:09 am Post subject:
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.
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.
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.
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Mon Sep 06, 2004 7:12 am Post subject:
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.
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