View previous topic :: View next topic
|
Author |
Message |
Abi
New User
Joined: 27 Jul 2005 Posts: 35 Location: Chennai
|
|
|
|
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 |
|
|
bipinpeter
Active User
Joined: 18 Jun 2007 Posts: 213 Location: Cochin/Kerala/India
|
|
|
|
Is any way to identify the records which is coming from whcih file?
Can you post the record structure also? |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Abi
New User
Joined: 27 Jul 2005 Posts: 35 Location: Chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Abi
New User
Joined: 27 Jul 2005 Posts: 35 Location: Chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Abi
New User
Joined: 27 Jul 2005 Posts: 35 Location: Chennai
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
Abi
New User
Joined: 27 Jul 2005 Posts: 35 Location: Chennai
|
|
|
|
Hi Frank,
I'm curious to know the 1 pass solution also . |
|
Back to top |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|