SORT two files in a single step.

IBM's Sort Product, ICETOOL, ICEMAN and ICEGENER.
Post Reply
KevalS
New Member
Posts: 2
Joined: Wed Sep 16, 2015 8:37 am

SORT two files in a single step.

Post 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.
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 826
Joined: Wed Sep 11, 2013 3:57 pm

Re: SORT two files in a single step.

Post 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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
User avatar
Magesh_j
Registered Member
Posts: 33
Joined: Sun Sep 04, 2016 8:50 pm

Re: SORT two files in a single step.

Post 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
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DFSort, ICETOOL, ICEMAN, ICEGENER.”