Previous Topic

Next Topic

Book Contents

Book Index

Local Variables and Global Variables

User-defined AutoEdit variables are classified as either Local variables or Global variables.

Thus far, all the user-defined variables that you have used in this chapter have been Local variables. A characteristic of Local variables is that values given to them by a job do not carry beyond that job—those values cannot be accessed or changed by a different job.

By contrast, Global variables are stored in the IOA Global Variable database and can be accessed and updated by other jobs.

Shortly, you will create Global variables and demonstrate their global nature. Before doing that, however, you should observe the local nature of the Local variables.

  1. Enter the job scheduling definition for IDJOB6 and add the following SET VAR statements, and then exit the job scheduling definition:

    SET VAR   %%LOC1=111

    SET VAR   %%BRANCH01_TAPE=222222

  2. Enter the job scheduling definition for IDJOB7 and delete the SET VAR definition. The job scheduling definition now contains no SET VAR definition.
  3. Edit the JCL for job IDJOB7, and do the following:
    1. Delete the comment line:

      //* TAPE ID PROVIDED: %%TAPEID

    2. Add, in its place, the following comment lines:

      //* %%LIBSYM CTM.TEST.AUTOEDIT %%MEMSYM IDTAPE
      //* BRANCH01_TAPE HAS THE VALUE: %%BRANCH01_TAPE
      //* LET’S SEE IF THIS RESOLVES: %%LOC1

    3. Exit the JCL.
  4. Order the job scheduling definition of IDJOB6.
  5. After job IDJOB6 has successfully ended, order the job scheduling definition of job IDJOB7.
  6. Check the results of the job orders in the Active Environment screen. Job IDJOB6 ended "OK", but job IDJOB7 was not submitted.
  7. Request the log for IDJOB7, by using Option L.

    The log indicates that IDJOB7 was not submitted because variable %%LOC1 could not be resolved. Since IDJOB6, which successfully executed, defined a value for %%LOC1, it is clear that IDJOB7 has no access to this value. This is because %%LOC1 is a local variable.

  8. Edit the JCL for job IDJOB7, delete the following comment line, and then exit the JCL:

    //* LET’S SEE IF THIS RESOLVES: %%LOC1

  9. Rerun job IDJOB7 through Option R in the Active Environment screen. The second run of IDJOB7 ended "OK".

    The job order line appears as follows in the Active Environment screen:

    IDJOB7   ID       020201 M21     /08316 JOB Ended "OK" (Run 2)       

                                                 Prior Run: Not Submitted

  10. Request SYSOUT of job IDJOB7, using Option V in the Active Environment screen followed by Option S in the Job Order Execution History screen, and scroll down to find the value for BRANCH01_TAPE.

    %%BRANCH01_TAPE resolved to the original value from %%MEMSYM member, 5554444, not the value set by the SET VAR statement in IDJOB6:

    //* BRANCH01_TAPE HAS THE VALUE: 5554444                                 

    Clearly, the SET VAR statement in IDJOB6 did not impact the value in the external member, which indicates that %%BRANCH01_TAPE is a local variable.

    Now that you’ve seen the limitations of Local variables, take a look at Global Variables.

Parent Topic

AutoEdit and JCL