|
View previous topic :: View next topic
|
| Author |
Message |
HammerTime
New User
Joined: 26 Sep 2012 Posts: 14 Location: UK
|
|
|
|
I seem to have come across some quirky behaviour with the way SORT writes to multiple outfiles in the same PDS, and I wondered if there was a way around this.
Here is an example of what i'm doing:
| Code: |
//STEP01 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
//SORTIN DD *
MY FAVOURITE TOOL IS A LLLLLL AND MY FAVOURITE NUMBER IS NNNNNN
//*
//SORTOF00 DD DSN=MY.PDS(FILE1),DISP=OLD
//SORTOF01 DD DSN=MY.PDS(FILE2),DISP=OLD
//SORTOF02 DD DSN=MY.PDS(FILE3),DISP=OLD
//*
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(10,10))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(10,10))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(10,10))
//*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01,
FINDREP=(INOUT=(C'LLLLLL',C'HAMMER',
C'NNNNNN',C'111111'))
OUTFIL FILES=02,
FINDREP=(INOUT=(C'LLLLLL',C'CHISEL',
C'NNNNNN',C'222222'))
OUTFIL FILES=03,
FINDREP=(INOUT=(C'LLLLLL',C'DRILL ',
C'NNNNNN',C'333333'))
|
Now I was hoping to see the PDS members containing the following after the JCL had run:
| Code: |
MY.PDS(FILE1): MY FAVOURITE TOOL IS A HAMMER AND MY FAVOURITE NUMBER IS 111111
MY.PDS(FILE2): MY FAVOURITE TOOL IS A CHISEL AND MY FAVOURITE NUMBER IS 222222
MY.PDS(FILE3): MY FAVOURITE TOOL IS A DRILL AND MY FAVOURITE NUMBER IS 333333 |
What we are actually getting is the final FINDREP being applied to all specified OUTFIL files:
| Code: |
MY.PDS(FILE1): MY FAVOURITE TOOL IS A DRILL AND MY FAVOURITE NUMBER IS 333333
MY.PDS(FILE2): MY FAVOURITE TOOL IS A DRILL AND MY FAVOURITE NUMBER IS 333333
MY.PDS(FILE3): MY FAVOURITE TOOL IS A DRILL AND MY FAVOURITE NUMBER IS 333333 |
It works fine if the various OUTFIL FILES are in a different PDS, but never when it's the same PDS.
I'm guessing it has something to do with the way SORT handles multiple outputs in a single PDS, but wondered if there is something we can do to override that? A wider part of our solution relies on the outputs (100 of) to be in the same PDS. |
|
| Back to top |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10903 Location: italy
|
|
|
|
| Quote: |
| 'm guessing it has something to do with the way SORT handles multiple outputs in a single PDS, |
NOPE it has to do how control info is handled by PDS data management
at open time it will find the TTR where to start writing the records
so multiple open will return the same TTR
and the content will be the same ( clobbered ) for each member created
( the PDS directory at STOW will point to the same TTR for all of them )
only the close will write back the info on the new starting <address>
how the data is clobbered will just depend on the timing of the writes
You will have to write to temporary sequential files
and write the pds members serially.
unless Your organization is willing to migrate to PDSE |
|
| Back to top |
|
 |
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
No, it is not quirky, and it is not restricted to SORT.
What you are doing, multiple DD names writing at the same time, should not be attempted with a PDS. The open for each DDNAME will get a separate copy of the directory, and then with each close you will successively lose the data from the previous directory written by the previous close.
You could check if it is possible with a PDSE, or write one sequential file in a format to load data into multiple members of a PDS.
Edit: You beat me enrico. I've always assumed it was the directory getting mashed - I guess same results either way :-) |
|
| Back to top |
|
 |
HammerTime
New User
Joined: 26 Sep 2012 Posts: 14 Location: UK
|
|
|
|
Unfortunately each PDS member is a reasonable sized JCL, so writing them all out to 1 DS and splitting them into multiple members isn't really practical.
Just given it a go with a PDSE and it worked! Thank you so much.
That is twice in 24 hours you have come to my rescue! |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Hammertime,
You can't use OUTFIL to write to three PDS members in parallel. You can do that with regular sequential data sets or with PDSE members, but NOT with PDS members. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
If you create a new temporary file for each of the new members and immediately copy them to the target PDS,l wyou will have no problems.
Suggest you back up the entire pds before starting and one by one copy the temporary files into their proper member names, deleting the temporary files to free the temporary space. |
|
| Back to top |
|
 |
HammerTime
New User
Joined: 26 Sep 2012 Posts: 14 Location: UK
|
|
|
|
Forgot to add closure to this thread. I was indeed able to use PDSE (LIBRARY) and it worked a treat.
Thank you all.
Edit - just realised I had actually responded in Feb to say it had worked. Ah well, happier to sing praises twice than not at all!  |
|
| Back to top |
|
 |
|
|