Expand all | Collapse all

Get Value of Global Variable in Batch

Jump to Best Answer
  • 1.  Get Value of Global Variable in Batch

    Posted 06-26-2018 03:12 PM

    Is it possible to get the value of an OPS/MVS Global Variable through a batch process?  An active automation process updates the value of a permanent global variable in OPS/MVS.  Is it possible for a batch job to capture the value of the variable to determine what steps should be executed in the batch job?




  • 2.  Re: Get Value of Global Variable in Batch
    Best Answer

    Broadcom Employee
    Posted 06-26-2018 07:06 PM

    Hello Steve,


    Yes, it is possible. Let's suppose you have a global variable named GLOBAL.RC where you have a numeric return code assigned. So you can create a REXX program as simple as:


    Command ===>
    ***************************** Top of Data
    retcode = opsvalue('GLOBAL.RC','O')
    exit retcode
     **************************** Bottom of Data


    Then create a JCL step to execute this REXX program:


    //CMD EXEC PGM=OI,PARM='CHKRC' <- name of the member where the REXX program is
    //OPS$OPSS DD DUMMY <- OPS subsystem id OPSS


    This step you end with the return code as set in the global variable GLOBAL.RC so that you can use JCL COND or IF statements to control the execution of subsequent steps.

    You may need to include some more code to check if the global variable exists before using it and any other logic required by your application.




    Carlos Mario Filho
    Principal Support Engineer

  • 3.  Re: Get Value of Global Variable in Batch

    Broadcom Employee
    Posted 06-29-2018 09:24 AM

    Hi Steve,


    Were you able to review and verify the information provided by Mario?

  • 4.  Re: Get Value of Global Variable in Batch

    Posted 06-29-2018 04:08 PM
      |   view attached



    Yes, the information from Mario was helpful.