Joined: 02 Dec 2002 Posts: 628 Topics: 176 Location: Stockholm, Sweden
Posted: Fri Mar 05, 2021 9:31 am Post subject: Override SYSIN statement in PROC
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).
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: -
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Sat Mar 06, 2021 1:10 pm Post subject:
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.
Joined: 02 Dec 2002 Posts: 628 Topics: 176 Location: Stockholm, Sweden
Posted: Sat Mar 06, 2021 1:19 pm Post subject:
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=&>DB2T,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=&>DB2T,DISP=(OLD,DELETE)
but this gives
Quote:
GTDB2T - DATA SET SYS21065.T192112.RA000.IAT473A.GTDB2T.H02 NOT FOUND
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Sat Mar 06, 2021 4:34 pm Post subject:
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=&>DB2T,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 &>DB2T 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
Joined: 02 Dec 2002 Posts: 628 Topics: 176 Location: Stockholm, Sweden
Posted: Sat Mar 06, 2021 5:28 pm Post subject:
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
/*
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