MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Override SYSIN statement in PROC

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
misi01
Advanced


Joined: 02 Dec 2002
Posts: 619
Topics: 172
Location: Stockholm, Sweden

PostPosted: Fri Mar 05, 2021 9:31 am    Post subject: Override SYSIN statement in PROC Reply with quote

The background is as follows. I want to be able to pass a parameter to a COBOL program and read it in via OPEN INPUT ....
Passing it in as a parameter to the actual program is not an option (I don't think).

My proc call looks like this:
Code:

//GTDB2GEN EXEC GTDB2DRV,                       
//         JCLSKEL=IAT473.PRIV.JCL(JCLSKEL),     
//         SYSTEM=DKTOCS,                       
//         PROGRAM=Q3321000,                     
//         TABLE=TGEWSOP                         
//*        COPYFIL=YOUR.COPYBOOK.PDS(MSABP004)   

and the DD statement in the PROC is as follows:-
Code:

//GTDB2T   DD  DSN=&&GTDB2T,DISP=(OLD,DELETE)

I have coded my JCL as follows: -
Code:

//GTDB2GEN EXEC GTDB2DRV,                       
//         JCLSKEL=IAT473.PRIV.JCL(JCLSKEL),     
//         SYSTEM=DKTOCS,                       
//         PROGRAM=Q3321000,                     
//         TABLE=TGEWSOP                         
//*        COPYFIL=YOUR.COPYBOOK.PDS(MSABP004)   
//*                                             
//GTDB2DRV.GTDB2T DD *                           
PROGRAM=&PROGRAM                                 
/*                                               

which is "sort of" working, inasmuch as the the parameter is being passed to my program. The trouble is, the display of the result is
Quote:

Program name passed in &PROGRAM

So, my question is, can anyone come up with a way of passing (in this example) the value Q3321000 via the override, so the resulting display in the program is: -
Quote:

Program name passed in Q3321000


Thanks
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Fri Mar 05, 2021 10:57 am    Post subject: Reply with quote

misi01,

You need to use EXPORT to pass symbols to SYSIN. For JCL you would JCLONLY and for procs you would use EXECSYS. something like this
Code:


// EXPORT SYMLIST=*                           
// SET  PROGRAM='Q3321000'
       
//GTDB2DRV.GTDB2T DD *,SYMBOLS=EXECSYS   


Check this link for an example.

https://www.mvsforums.com/helpboards/viewtopic.php?p=62787#62787
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 619
Topics: 172
Location: Stockholm, Sweden

PostPosted: Sat Mar 06, 2021 12:02 pm    Post subject: Reply with quote

Thanks for your reply, but I can't get to where it works. This is what I'm doing (wrongly)
Code:


//PROCLIB  JCLLIB ORDER=(my.proclib)
//*                                                           
//MYEXP    EXPORT SYMLIST=*                                   
//GTDB2GEN SET  PROGRAM='Q3321000'                           
//*                                                                           
//GTDB2GEN EXEC GTDB2DRV,                                     
//         JCLSKEL=myuser.PRIV.JCL(JCLSKEL),                 
//         SYSTEM=DKTOCS,                                     
//         PROGRAM=Q3321000,                                 
//         TABLE=TRIKORT                                     
//*        COPYFIL=YOUR.COPYBOOK.PDS(MSABP004)               
//*                                                           
//GTDB2DRV.GTDB2T DD *,SYMBOLS=EXECSYS                       


and the PROC contains
Code:


//*                                 
//DEFAULT  PROC SYSTEM=&SYSTEM,     
//         JCLSKEL=&JCLSKEL,       
//         PROGRAM=&PROGRAM,       
//         TABLE=&TABLE,           
//         COPYFIL='NULLFILE'       
//*
//EXPORT SYMLIST=(SYSTEM,PROGRAM,TABLE)           
//SET SYSTEM=&SYSTEM,PROGRAM=&PROGRAM,TABLE=&TABLE
//*
//IMSDEL EXEC PGM=IDCAMS                       
//*                                           
//SYSPRINT DD SYSOUT=*                         
//*                                           
//SYSIN DD *,SYMBOLS=JCLONLY                   
  DELETE &SYSUID..&SYSTEM..&TABLE
  delete other files as well
  SET MAXCC=0                                 
//*                                           
//*                                           
//GTDB2DRV EXEC PGM=IKJEFT1B                   
//*                                           
//STEPLIB  INCLUDE MEMBER=STEPLIB
//SYSTSIN  DD  *                                         
  DSN SYSTEM(DB2C)                                       
  RUN PROGRAM(GTDB2DRV) PLAN(BATCHIC)                   
  END                                                   
/*                                                       
//*                                                     
//GTDB2T   DD DATA,DLM=@@,SYMBOLS=JCLONLY    <- This gave a JCL error
//*GTDB2T   SYSIN *         <--- this obviously doesn't work
//*PROGRAM=&PROGRAM                                     
//*
//*GTDB2T   DD  DSN=&&GTDB2T,DISP=(OLD,DELETE) This was my original attempt                                                       
//*                                                                                 

My problem is how to define the GTDB2T DD name so it (and its contents) get passed in to the GTDB2DRV cobol program
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Sat Mar 06, 2021 1:10 pm    Post subject: Reply with quote

misi01,

I am not sure what you are trying to do, but I will give an example of how to override the instream values in a proc

There are couple of issues with your coding.

1. You named the proc DEFAULT , but you are invoking it using GTDB2DRV which is a step name in the proc.

2. It is NOT clear as to what you want to override. Is it the Program name in SYSTSIN ? or SYSIN ?

3. The EXPORT statement should be in the JCL and NOT the Proc

4. The rule of thumb is that if you want to override the INSTREAM data in a PROC you would use EXECSYS on the ddname and if you want to override the INSTREAM data in a JCL you would need JCLONLY parm for symbol substitution.

5. DLM=@@ is used to flag/protect data and treat them as normal data instead of JCL statements and you would end it with the DLM which in this case is @@, all the contents in between these tags will be treated as normal data rather than JCL statements.

Either way here is a JCL/PROC that will get you the desired results

Your PROC which would allow you to pass &SYSTEM &PROGRAM &PLAN to SYSTSIN and TABLE name to SYSIN.

Code:

//DEFAULT  PROC SYSTEM=&SYSTEM,     
//         JCLSKEL=&JCLSKEL,         
//         PROGRAM=&PROGRAM,         
//         TABLE=&TABLE,
//         PLAN=&PLAN,           
//         COPYFIL='NULLFILE'       
//*                                 
//IMSDEL   EXEC PGM=IDCAMS           
//SYSPRINT DD SYSOUT=*               
//SYSIN    DD *,SYMBOLS=EXECSYS     
  DELETE &SYSUID..&SYSTEM..&TABLE   
  SET MAXCC=0                       
/*   
//GTDB2DRV EXEC PGM=IKJEFT1B               
//STEPLIB  INCLUDE MEMBER=STEPLIB           
//SYSTSPRT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*                     
//SYSTSIN  DD *,SYMBOLS=EXECSYS 
  DSN SYSTEM(&SYSTEM)                     
  RUN PROGRAM(&PROGRAM) PLAN(&PLAN)
  END
/*
//SYSIN    DD *,SYMBOLS=EXECSYS
  SELECT * FROM &TABLE
/*




Now JCL
Code:

//MISIPROC JOB (B004273,BIN#,BLDG#,DEPT#),&SYSUID,             
//         MSGCLASS=H,MSGLEVEL=(1,1),CLASS=A,NOTIFY=&SYSUID   
/*                                                             
//         EXPORT SYMLIST=*     
//         SET PROGRAM='Q3321000'
//         SET SYSTEM=DKTOCS     
//         SET TABLE=TRIKORT     
//         SET PLAN=BATCHIC
//*
//GTDB2GEN EXEC DEFAULT         
 

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 619
Topics: 172
Location: Stockholm, Sweden

PostPosted: Sat Mar 06, 2021 1:19 pm    Post subject: Reply with quote

Okay, first of all, thanks for the pointers. Here's where I am at the moment:-

Quote:

1. You named the proc DEFAULT , but you are invoking it using GTDB2DRV which is a step name in the proc.

2. It is NOT clear as to what you want to override. Is it the Program name in SYSTSIN ? or SYSIN ?


I originally copied some PROC from somewhere, and automatically assumed (in my mind) that the DEFAULT label meant that if you didn't pass in a named parameter, then the value on that line was the default value (seemed logical to me, so I never thought to query my thinking - plus it seemed to work)

As to your question about SYSTSIN ? or SYSIN, my original lines in the proc were
Code:

//GTDB2T   DD  *
PROGRAM=&PROGRAM
/*

and
Code:

//GTDB2T   DD  DSN=&&GTDB2T,DISP=(OLD,DELETE)

(again, copied from somewhere).

The long of the short of it is, is that I want to be able to pass in the value
Quote:

PROGRAM=Q3321000

to the Cobol program (which will do an open/read on DD-name GTDB2T).

Oh, and by the way, these are the PROC lines I have at the moment
Code:

//GTDB2T   DD *,SYMBOLS=EXECSYS 
  PROGRAM=&PROGRAM               
/*                               

and
Code:

//GTDB2T   DD  DSN=&&GTDB2T,DISP=(OLD,DELETE)

but this gives
Quote:

GTDB2T - DATA SET SYS21065.T192112.RA000.IAT473A.GTDB2T.H02 NOT FOUND

_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Sat Mar 06, 2021 4:34 pm    Post subject: Reply with quote

misi01 wrote:
I originally copied some PROC from somewhere, and automatically assumed (in my mind) that the DEFAULT label meant that if you didn't pass in a named parameter, then the value on that line was the default value (seemed logical to me, so I never thought to query my thinking - plus it seemed to work)


misi01,

I highly doubt it. The only way it would have worked if you had a PROC named GTDB2DRV in your (my.proclib). If you don't have a member by that name then you would have gotten a JCL error.


misi01 wrote:

Oh, and by the way, these are the PROC lines I have at the moment
Code:

//GTDB2T   DD *,SYMBOLS=EXECSYS 
  PROGRAM=&PROGRAM               
/*                               

and
Code:

//GTDB2T   DD  DSN=&&GTDB2T,DISP=(OLD,DELETE)

but this gives
Quote:

GTDB2T - DATA SET SYS21065.T192112.RA000.IAT473A.GTDB2T.H02 NOT FOUND


misi01,

Why do you have 2 DD names for GTDB2T ? The reason you are getting that error is because the temporary dataset &&GTDB2T is supposed to created earlier and it is being read in this step. Your proc does NOT have the step which creates the temp dataset. Do you really need that dataset?


Are you coding the PROC from scratch ? or you modifying an existing PROC?

If the Proc already has //GTDB2T coded in it and if you want to override it then you can do that in the JCL as follows

Code:

//GTDB2GEN EXEC DEFAULT
//GTDB2DRV.GTDB2T  DD *,SYMBOLS=EXECSYS 
  PROGRAM=&PROGRAM               
/*   

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 619
Topics: 172
Location: Stockholm, Sweden

PostPosted: Sat Mar 06, 2021 5:28 pm    Post subject: Reply with quote

Quote:
The only way it would have worked if you had a PROC named GTDB2DRV in your (my.proclib).

But that's the point isn't it?. I never said the PROC was called DEFAULT. It is called GTDB2DRV. Like I said, I thought the DEFAULT was required to indicate that if you didn't pass a specific parameter to the PROC from the JCL, then default value for that parm was what was defined on the DEFAULT line. In the example, if I don't pass in a COPYFIL parm, then the default reverts to NULLFILE, and the //COPYFIL is happy.

Anyway, thank you for your help, which got me there in the end. Here are the final JCL and PROC contents
First the JCL
Code:

//IAT473A JOB (CC00,),'IKKT/TRIKORT',CLASS=1,                 
//           MSGCLASS=X,NOTIFY=&SYSUID                       
//*                                                           
//PROCLIB  JCLLIB ORDER=(IAT473.PRIV.PROCLIB)
//*                                                           
//         EXPORT SYMLIST=*                                   
//         SET JCLSKEL=IAT473.PRIV.JCL(JCLSKEL)               
//         SET PROGRAM=Q3321000                               
//         SET SYSTEM=DKTOCS                                 
//         SET TABLE=TRIKORT                                 
//*                                                           
//*GTDB2GEN EXEC GTDB2DRV                                     
//*                                                           
//GTDB2GEN EXEC GTDB2DRV                                     
//*
//* Note how the next line points to the step-name in PROC GTDB2DRV and the actual
//* DD name we want to replace with the "sysin" statement PROGRAM=&PROGRAM
//* (which will be resolved to PROGRAM=Q3321000 because of the
//* SYMBOLS=EXECSYS                                                           
//GTDB2PRG.GTDB2T  DD *,SYMBOLS=EXECSYS                       
  PROGRAM=&PROGRAM                                           
/*                                                           

and now the PROC (called GTDB2DRV)
Code:

//         PROC SYSTEM=&SYSTEM,                   
//         TABLE=&TABLE,                         
//         JCLSKEL=&JCLSKEL,                     
//         PROGRAM=&PROGRAM,                     
//         COPYFIL='NULLFILE'                     
//*                                               
//IMSDEL EXEC PGM=IDCAMS                         
//*                                               
//SYSPRINT DD SYSOUT=*                           
//*                                               
//SYSIN DD *,SYMBOLS=JCLONLY                     
  DELETE &SYSUID..GTDB2DRV.OUTPUT                 
  DELETE &SYSUID..&SYSTEM..&TABLE                 
  DELETE &SYSUID..&SYSTEM..&PROGRAM..&TABLE       
  DELETE &SYSUID..&TABLE..TRACEFIL               
  SET MAXCC=0                                     
//*                                               
//*
//COPYFIL  DD  DSN=&COPYFIL,DISP=SHR 
//*                                             
//GTDB2PRG EXEC PGM=IKJEFT1B                     
//*                                                         
//STEPLIB  INCLUDE MEMBER=STEPLIB                           
//*                                                         
//SYSTSIN  DD  *                                           
  DSN SYSTEM(DB2C)                                         
  RUN PROGRAM(GTDB2DRV) PLAN(BATCHIC)                       
  END                                                       
/*                                                           
//*                                                         
//GTDB2T   DD  DISP=SHR,DSN=&GTDB2T                         
//* 


This worked fine, and I saw the value PROGRAM=Q3321000 in my Cobol program when I opened and read GTDB2T.

Thank you for your help and patience in solving this.
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Mon Mar 08, 2021 10:21 am    Post subject: Reply with quote

misi01 wrote:

This worked fine, and I saw the value PROGRAM=Q3321000 in my Cobol program when I opened and read GTDB2T.

Thank you for your help and patience in solving this.


misi01,

Glad to hear that it is working.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group