Page 1 of 1

SORT two files in a single step.

Posted: Sat Sep 10, 2016 8:35 pm
by KevalS
Hi,

I need help in sorting two datasets, with same sort condition. After SORT I want to write the two different corresponding OUTPUT files. But the catch is, I want to do it in a single step than in two steps. So I have the following condistions:

Input dataset 1: LRECL = 80 and RECFM=FB
Input dataset 2: LRECL = 100, RECFM=FB

Sort condition to be used is sort fields=(1,6,CH,A)

OUTPUT 1: LRECL = 80, RECFM=FB
OUTPUT 2: LRECL = 100 , RECFM=FB



I know I can do it in two steps but if I want to do it in a single step, how can I do this? Please help.

Re: SORT two files in a single step.

Posted: Sat Sep 10, 2016 9:05 pm
by enrico-sorichetti
so that if something goes wrong You will have to ...

- rerun the failing step doing probably some processing not needed
- change the failing step to sort only one of the two dataset

most probably nobody will care about providing a solution for an unreasonable approach

Re: SORT two files in a single step.

Posted: Sat Sep 10, 2016 11:44 pm
by Magesh_j
KevalS,

You cant concatenate two different file attribute with dfsort.

As enrico mentioned not sure why you need it in one step solution

Here is the one step solution.

Note: though you see only one step, internally it is consider as two step only.

This solution is not at all recommended, if second file fails for some reason, you need start the job again and it will have to copy first file and second file too which means you are unnecessarily wasting resource.

Code: Select all

//CPYJK EXEC PGM=ICETOOL                        
//TOOLMSG DD SYSOUT=*                           
//SYSOUT DD SYSOUT=*                            
//DFSMSG DD SYSOUT=*                            
//IN1 DD DSN=YOURFILE1/FB80                          
//IN2 DD DSN=YOURFILE2/FB100                          
//OUT1 DD DSN=YOUFILEOUT/FB80                        
//OUT2 DD DSN=YOURFILEOUT/FB100                       
//TOOLIN DD *                                   
  COPY FROM(IN1) TO(OUT1) USING(CTL1)           
  COPY FROM(IN2) TO(OUT2) USING(CTL1)           
//CTL1CNTL DD *                                 
  SORT FIELDS=(1,6,CH,A)                        
Thanks
Magesh