IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort more than 1 file using the same sort condition


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Mon Jul 20, 2009 3:53 pm
Reply with quote

Hi,

I have 3 files
File 1 ,File 2 & File 3 .I need to sort all these files using the cond SORT FIELDS=(72,5,CH,A) and need to generate 3 o/p files .

Is it possible to sort 3 different files to form 3 output files with the same sort condition in a single step .
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon Jul 20, 2009 5:36 pm
Reply with quote

Is any way to identify the records which is coming from whcih file?
Can you post the record structure also?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Jul 20, 2009 5:58 pm
Reply with quote

Abi,

Assuming there is no criteria and just a plain sort on fields (72,5,CH,A)

Code:

//S1      EXEC PGM=ICETOOL                   
//TOOLMSG DD SYSOUT=*                       
//DFSMSG  DD SYSOUT=*                       
//IN1     DD DSN=<INPUT 1>,DISP=SHR         
//IN2     DD DSN=<INPUT 2>,DISP=SHR         
//IN3     DD DSN=<INPUT 3>,DISP=SHR         
//OUT1    DD DSN=<OUTPUT 1>,                 
//           DISP=(NEW,CATLG,DELETE),
//           SPACE=(CYL,(100,100),RLSE)     
//OUT2    DD DSN=<OUTPUT 2>,                 
//           DISP=(NEW,CATLG,DELETE),
//           SPACE=(CYL,(100,100),RLSE)     
//OUT3    DD DSN=<OUTPUT 3>,                 
//           DISP=(NEW,CATLG,DELETE),
//           SPACE=(CYL,(100,100),RLSE)     
//TOOLIN DD *                               
  SORT FROM(IN1) TO(OUT1) USING(CTL1)       
  SORT FROM(IN2) TO(OUT2) USING(CTL1)       
  SORT FROM(IN3) TO(OUT3) USING(CTL1)       
/*                                           
//CTL1CNTL DD *                             
  SORT FIELDS=(72,5,CH,A)                   
/*                                           



OUT1 will have sorted IN1
OUT2 will have sorted IN2
OUT3 will have sorted IN3

Please try this and let me know if this is what you want.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jul 20, 2009 9:53 pm
Reply with quote

Abi,

Whether or not you can do this in one pass or three passes depends on the RECFM and LRECL of the input files, and what the records in each input file look like.

Please show an example of the records in each input file and what you expect for the output files. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field.
Back to top
View user's profile Send private message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Tue Jul 21, 2009 12:49 pm
Reply with quote

Thank all of you for the response .I tried the jcl given by premkrishnan
.It worked .

Frank ,
All the three files has LRECL=1703 and RECFM=VB
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Tue Jul 21, 2009 8:38 pm
Reply with quote

Quote:
Please show an example of the records in each input file and what you expect for the output files. Give the RECFM and LRECL of the input file. Give the starting position, length and format of each relevant field.


You only supplied one piece of the three pieces of information I asked for.
Back to top
View user's profile Send private message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Wed Jul 22, 2009 11:45 am
Reply with quote

Sorry ,

All the thre input files consists of agent detailswhich will occur more than once .I need to sort the file on agent id (0GGWT)in position 68 and it's of length 5 so the on similar agents
since it's a VB file i gave starting position of the sort as 72.sort on fields (72,5,CH,A)

EX: i/p File

01B41XXXXXXXXXXXXXXXXXXXXXX0GGWTXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0FEGJXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
O/P
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWTXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0GGWWXXXXXXXXXXXXXXXXXXXXX
01B41XXXXXXXXXXXXXXXXXXXXXX0FEGJXXXXXXXXXXXXXXXXXXXXX
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Wed Jul 22, 2009 8:54 pm
Reply with quote

Quote:
Please show an example of the records in each input file


each input file. Showing just one input file doesn't help. I'm trying to determine if there's anything unique in each input file that identifies it. If not, then you can't do it in one pass.
Back to top
View user's profile Send private message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Thu Jul 23, 2009 10:16 am
Reply with quote

All the 3 i/p file are of same record structure ,the different is that it consists of different region codes in the 4th position of the file and it's of length is 2.

Can't i use the icetool jcl give above ?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Thu Jul 23, 2009 9:43 pm
Reply with quote

Quote:
Can't i use the icetool jcl give above ?


Yes, you can use that 3 pass solution. I was trying to determine if you could use a 1 pass solution which might be more efficient. If each file only has a specific set of region codes, then a 1 pass solution might be possible, but at this point, it's probably not worth pursuing if you're ok with the 3 pass solution.
Back to top
View user's profile Send private message
Abi

New User


Joined: 27 Jul 2005
Posts: 35
Location: Chennai

PostPosted: Mon Jul 27, 2009 4:11 pm
Reply with quote

Hi Frank,
I'm curious to know the 1 pass solution also . icon_biggrin.gif
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Mon Jul 27, 2009 7:53 pm
Reply with quote

It look to me that the ICETOOL solution above uses 1 pass of each of the input files. I believe that that would be more efficient than 1 pass of all 3 files put together. Am I wrong about this? Normally the efficiency goes down by a power of the number of records being sorted, doesn't it?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Mon Jul 27, 2009 8:59 pm
Reply with quote

Quote:
I believe that that would be more efficient than 1 pass of all 3 files put together. Am I wrong about this?


You may actually be right (I was thinking of copy operations, not sort operations). However, whether three smaller sorts or one larger sort would be more efficient depends on a lot of factors. The only way to know for sure would be try both and compare. But I agree that I should have said "might be more efficient" rather than "would be more efficient". I've corrected my post.

Quote:
I'm curious to know the 1 pass solution also


If the records of each file are identifiable, we can sort them all and then use OUTFIL with INCLUDE to write the sorted records to the correct output files. I'm guessing the records of each file are NOT identifiable here so that solution wouldn't apply.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 2
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top