Page 1 of 1

Passing a variable parm from JCL to a cobol/db2 program

PostPosted: Fri Jul 10, 2009 7:57 pm
by paolinux
Hi everybody ,
I'm new here and I need some help(that's the reason I'm here :D )
I'm trying to write a batch cobol/db2 pgm wich receive in linkage section some paremeters.
I succeeded to pass a static string of characters but what I need is variable parameters.
I tried declaring the parameter in the CA7 job but I have to use them inside a SYSTSIN * like this
DSN SYSTEM(SDIA)                                             
    RUN  PROGRAM (ZWAC200) PLAN (ZWAC200)-                   
    PARMS('&PAR1,&PAR2,&PAR3,&PAR4,&PAR5,&PAR6,&PAR7,&PAR8') 
END


The problem is that when I run the job the JCL returns an error becaues it doesn't see that I'm using the parameters I've declared.
The error is :
3 IEFC657I THE SYMBOL PAR1 WAS NOT USED


Do you think there's a way to do what I'm trying or it's better to think to something else ?

Re: Passing a variable parm from JCL to a cobol/db2 program

PostPosted: Fri Jul 10, 2009 8:20 pm
by MrSpock
I'm certainly not a CA-7 expert. Does it know how to perform variable substitution if the variables are located in the data, as your example shows, instead of in the JCL? My gut feeling is that it wouldn't perform a variable substitution on data since that could easily cause a data integrity problem.

I'd recommend that you move your variables out into the JCL (as specified in a PARM= statement) as input to a program, and have that program accept the parameters as input and write them out to a simple 80-byte FB dataset that you can specify as input to the SYSTSIN DD statement.

Re: Passing a variable parm from JCL to a cobol/db2 program

PostPosted: Fri Jul 10, 2009 9:05 pm
by paolinux
Yes, this is my second option :) .
The CA7 can make the substitution but it seems that i'ts not possibile to pass dynamic parameters to to DB2 systsyn dd statement. For wath I've seen I can olny pass a static string to a DB2 program.
I'm not sure that it's possibile to do what I'm trying to do but I was hoping to find a easier way out ;)
Thanks, anyway.

Re: Passing a variable parm from JCL to a cobol/db2 program

PostPosted: Sat Jul 11, 2009 1:23 am
by dick scherrer
Hello,

You might consider running a program* that used symbolic variables in the parm and then generate the static parm for use with the db2 program. The posted DSN...END appear to be inline, but could also be in some member that was re-created from dynamic variables.

* this would be a very small bit of code that processed the parm and wrote the DSN...END with the actual values from the symbolic parameter(s).