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

Help needed on DISP


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Tue Jan 14, 2014 4:42 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Tue Jan 14, 2014 5:01 pm
Reply with quote

  • 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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jan 14, 2014 7:56 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 15, 2014 10:35 am
Reply with quote

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
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jan 15, 2014 2:25 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 15, 2014 2:29 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Jan 15, 2014 3:16 pm
Reply with quote

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
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Wed Jan 15, 2014 3:21 pm
Reply with quote

Thanks Bill... That cleared me up. who would want messed up file anyway icon_lol.gif
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Jan 16, 2014 1:25 pm
Reply with quote

Thanks a lot for all of you, for your suggestions !!!!!!!!

Regards,
Srini
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 16, 2014 9:52 pm
Reply with quote

You're welcome - so how are you going to implement?

d
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Mainframe Programmer with CICS Skill... Mainframe Jobs 0
No new posts Help needed to assemble IMS sample co... ABENDS & Debugging 4
No new posts RABBIT HOLE NEEDED - "Live"... All Other Mainframe Topics 0
No new posts Mainframe profiles needed @ Cognizant Mainframe Jobs 0
No new posts COBOL Student learning COBOL File Han... COBOL Programming 3
Search our Forums:

Back to Top