Replace Symbolic variable using Cobol Program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Replace Symbolic variable using Cobol Program

Postby ravi11081992 » Sat Jul 20, 2019 6:21 pm

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
ravi11081992
 
Posts: 19
Joined: Mon Apr 30, 2018 5:47 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Replace Symbolic variable using Cobol Program

Postby steve-myers » Sat Jul 20, 2019 8:01 pm

  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.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: Replace Symbolic variable using Cobol Program

Postby willy jensen » Sat Jul 20, 2019 8:08 pm

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.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: Replace Symbolic variable using Cobol Program

Postby NicC » Mon Jul 22, 2019 2:38 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post