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

How to Replace DD Name?


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Permander Malik

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Mon Nov 02, 2009 2:17 pm
Reply with quote

Hi All,

Is there any way to override a specific DDNAME in PROC from a JCL?

P.M
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 02, 2009 2:36 pm
Reply with quote

Yes, click the button marked "IBM Manuals" at the top of any page, and go read the JCL reference manual.
Back to top
View user's profile Send private message
Permander Malik

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Mon Nov 02, 2009 2:44 pm
Reply with quote

Suppose my Proc is like:
//PROC

//STEP1 EXEC PGM=PGM1

//DD1 DD DSN=FILE1

If Want to override file1 with file2 then in my JCL I will write as:
//STEP1.DD1 DD DSN=FILE2

But suppose I want to override DD1 with DD2.

Then how we can override DD1 with DD2 from a JCL?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 02, 2009 2:53 pm
Reply with quote

What exactly are you on about .................

You want to remove DD1 and insert DD2 ? Why ?
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Mon Nov 02, 2009 2:55 pm
Reply with quote

That's not overriding, by definition. When you want to override "DD1" with "DD2" -- what difference would that make to the JCL execution unless you change the DSN associated with that DD? Do you change the program executed in 'that-step" to include "DD2"(I assume COBOL program), if so, you should permanently change the JCL to use DD2 instead of using overrides.
Back to top
View user's profile Send private message
Permander Malik

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Mon Nov 02, 2009 3:10 pm
Reply with quote

This is Just for my knowledge. Is there any way?
I guess one way to replace DD1 with DD2 is
Make DD1 as dummy from JCL
Add DD2 in JCL
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 02, 2009 3:29 pm
Reply with quote

Correct, but as the program will open the DD names assigned within, it will not open DD2 and expect DD1
Back to top
View user's profile Send private message
Permander Malik

New User


Joined: 24 Oct 2009
Posts: 11
Location: Mumbai

PostPosted: Mon Nov 02, 2009 3:31 pm
Reply with quote

That's True.
Thank You
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Nov 02, 2009 6:32 pm
Reply with quote

Actually, you MIGHT try specifying

//STEP1.DD1 DD DDNAME=DD2

then adding

//STEP1.DD2 DD DSN=yadayadayada,etc.

This, in essence, tells the OS that any reference to DD1 should be redirected to DD2

Note: I know that this redirection works in runjcl ( especially to concatenate SYSIN statements with other files ), but do not know for certain, that it will work for overriding a PROC.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Nov 02, 2009 6:47 pm
Reply with quote

A nice way around it, one that I had completely forgotten about, but it will depend on where the DD ststements are in relation to each other. I knew that there was sone limitation to using this method so thought I'd test it out.

The example below will work as the 'Option' DD names follow the DD name affected
Code:

//MYPROC   PROC SYSIN=SYSIN1               
//STEP0020 EXEC PGM=IDCAMS                 
//SYSPRINT DD SYSOUT=*                     
//SYSIN    DD DDNAME=&SYSIN                 
//SYSIN1   DD DSN=AA.JCL(Member3),DISP=SHR
//SYSIN2   DD DSN=AA.JCL(Member4),DISP=SHR
//MYPROC   PEND                             
//*                                         
//MYPROC   EXEC MYPROC,SYSIN=SYSIN2         

However, the code below does not work
Code:

//MYPROC   PROC SYSIN=SYSIN1               
//STEP0020 EXEC PGM=IDCAMS                 
//SYSPRINT DD SYSOUT=*                     
//SYSIN1   DD DSN=AA.JCL(Member3),DISP=SHR
//SYSIN2   DD DSN=AA.JCL(Member4),DISP=SHR
//SYSIN    DD DDNAME=&SYSIN                 
//MYPROC   PEND                             
//*                                         
//MYPROC   EXEC MYPROC,SYSIN=SYSIN2         
Back to top
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Mon Nov 02, 2009 7:00 pm
Reply with quote

Correct, according to the JCL Reference Manual:

Place a DD statement containing a DDNAME parameter in a job step or in a cataloged or in-stream procedure. The referenced DD statement must be later in the same job step, must be in the calling job step, or must be in a cataloged or in-stream procedure called by the job step.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts To replace jobname in a file with ano... SYNCSORT 12
No new posts Conditional replace values in output ... DFSORT/ICETOOL 3
Search our Forums:

Back to Top