View previous topic :: View next topic
|
Author |
Message |
vicharapusrinu Warnings : 1 New User
Joined: 04 Dec 2006 Posts: 63 Location: Hyderabad
|
|
|
|
Hi,
would you please help me out please.
by making use use of SORT, I am planning to edit data set, here in my case both input and output data sets are same,(Here I am reading a field-1 and if it satisfy that condition I am changing field-2 of same file )
Here my question is what is DISP i have to give to SORTIN and SORTOUT?
Regards,
Srini |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
- It is usually a bad idea to specify the same data set for the SORTIN and SORTOUT data sets.
- JCL like this is sort of safe.
Code: |
//A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=...
//SYSUT2 DD DISP=(NEW,PASS),UNIT=SYSDA,...
//SYSIN DD DUMMY
//B EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=(OLD,PASS),DSN=*.A.SYSUT2
//SORTOUT DD DISP=(OLD,PASS),VOL=REF=*.SORTIN,
// DSN=*.A.SYSUT2
//SYSIN DD *
... |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
In most organizations, it is not acceptable to use the input file as output.
Change your process to create a new file. Then do whatever is needed to have the proper DSN(s) - i.e rename. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
As Mr. Steve & Mr. Dick mentioned, Its really a bad idea to use same data set for SORTIN & SORTOUT.
But if you have no choice then, this might help you.
Code: |
//STEP0001 EXEC PGM=SORT
//SORTIN DD DSN=Your DSN here,DISP=OLD
//SORTOUT DD DSN=Your DSN here,DISP=(OLD,CATLG,KEEP)
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
----Your condtion here----
//
|
|
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
If you are using DISP=OLD to read then dataset it is already cataloged so why have it on the output disposition? Also, OLD implies KEEP. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
I meant to make sure it won't get deleted when something goes wrong in that step.
I guess, it won't harm anything. am I wrong? |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
sureshpathi10,
It doesn't matter if it gets deleted when something goes wrong as it has already been corrupted. In your case, with COPY, the dataset is open for both input and output simultaneously, which is clearly and irrevocably bad. In the case of a SORT failing in the output stage, the input has already been destroyed, as it is the input dataset, now open for output.
vicharapusrinu,
This is an altogether bad idea. You would need to take a backup of your input dataset before doing the SORT, so that you have somewhere to recover to if something goes wrong. So, it is as simple to write your output to a different dataset, as has already been suggested several times. |
|
Back to top |
|
|
sureshpathi10
Active User
Joined: 03 May 2010 Posts: 154 Location: Kuala Lumpur
|
|
|
|
Thanks Bill... That cleared me up. who would want messed up file anyway |
|
Back to top |
|
|
vicharapusrinu Warnings : 1 New User
Joined: 04 Dec 2006 Posts: 63 Location: Hyderabad
|
|
|
|
Thanks a lot for all of you, for your suggestions !!!!!!!!
Regards,
Srini |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
You're welcome - so how are you going to implement?
d |
|
Back to top |
|
|
|