Page 1 of 1

Replace Symbolic variable using Cobol Program

PostPosted: Sat Jul 20, 2019 6:21 pm
by ravi11081992
Hi Guys,

There is a scenario -- Symbolic variable which is used in DSN name in JCL that has to be replaced from COBOL program

Is it possible to pass values other than 'return-code' from COBOL to JCL?

I looked into several websites but I couldn't get the desired code

For example:

//Ddname DD DSN=&var1, disp=shr

My requirement to replace this 'var1' from COBOL program, is it possible?

Thanks

Re: Replace Symbolic variable using Cobol Program

PostPosted: Sat Jul 20, 2019 8:01 pm
by steve-myers
  1. Replace JCL symbolic variable from code
    Can't be done. Period. End of story.
  2. Can't find code to replace JCL symbolic variable from code.
    Can't be done. All processing of JCL symbolic variables is done before any program invoked by the JCL is actually run, so even if it were possible it would useless. Since it can't be done, there is no code to find.

Re: Replace Symbolic variable using Cobol Program

PostPosted: Sat Jul 20, 2019 8:08 pm
by willy jensen
As steve-myers said, no can do. If you wish to use symbolic values for allocations in the same job step then you can use dynamic allocation. I believe that BPXWDYN is available for COBOL too.

Re: Replace Symbolic variable using Cobol Program

PostPosted: Mon Jul 22, 2019 2:38 am
by NicC
You can read in the JCL, change it and write it out to the internal reader. BUT, as said, you cannot change the executing JCL - in fact, it has already been discarded before the job runs.