Variable resolution process

When Workload Automation Programming Language runs a VARSUB SCAN or an ADD statement, it checks if the job is running within HCL Workload Automation for Z and set the supplied variables at this point.

The VARSUB SCAN statement also adds the GLOBAL and APPLICATION tables to the search sequence, unless you set a specific search sequence. This enables the searching for variables when needed. At any point, except within a Batch Loader object construct, you can issue VARSET statements to set variable values within Workload Automation Programming Language. You can do it even before the first VARSUB SCAN statement.

When a variable is found in a statement, Workload Automation Programming Language first checks if the variable was already set or referenced with the current running of Workload Automation Programming Language. If it was, that value is used, without looking up a new value from the table. Even if a variable was changed by a VARSET or VARDATE command, the latest value is always used.

If the variable was not set or referenced, Workload Automation Programming Language looks through the table search sequence by accessing the tables as required. By default, the first table searched is the APPLICATION table belonging to the occurrence running the Workload Automation Programming Language job; then the GLOBAL table is searched. To add extra tables to the beginning of the table search sequence, set the VARSUB TABLE statement; to remove the tables, set VARSUB CLOSE. You can specify the whole search sequence with the VARSUB SEARCH statement.

By default, if a variable is not found the resolution fails and the statement is not run. You can change this default by setting VARSUB VARFAIL.
Note:
  • If you renamed the GLOBAL table, specify the name in the OPTIONS GTABLE statement. For example:
    OPTIONS GTABLE (MYGLOBAL)
    VARSUB SCAN(!)
  • If you do not have a GLOBAL table, to prevent accessing it, specify OPTIONS GTABLE as follows:
    OPTIONS GTABLE ()
    VARSUB SCAN(!)
  • To prevent the APPL and GLOBAL tables being automatically added to the search path, issue the following command to set an empty search path before activating the variable scanning:
    VARSUB SEARCH(-) SCAN(!)
  • If you change the table search sequence by setting VARSUB CLOSE, SCAN, SEARCH, or TABLE the message EQQI022 is issued to report the search sequence at the point when it was modified. In the message, the application and global tables are shown as -APPL- and -GLOBAL-, respectively. This defers the potential search of the occurrence in the current plan until needed, which can save CPU processing if no table based variables are referenced later. The table names are listed if the tables are actually opened later.