Variable parsing rules

When activated, variable parsing searches for the variable prefix character and then treat every character that follows as a variable, until it finds either a character that cannot be part of a variable name or the termination character.

For example, the following command:
000001 VARSUB SCAN (!)
000002 VARSET CODE VALUE(YY)
000003 VARSET SUFFIX VALUE(1234)
000004 MODIFY CPOC ADID(!OADID) IA(!OYMD1!OHMM)
000005 MODIFY CPOP OPNO(!OOPNO.) 
000006 MODIFY CPUSRF UFNAME(CODE) UFVALUE(XX!CODE.ZZ)
000007 MODIFY CPUSRF UFNAME(COMPOUND) UFVALUE(!CODE..!SUFFIX)
000008 VARSUB NOSCAN
000009 MODIFY CPUSRF UFNAME(OK) UFVALUE(It worked!!!)
Is resolved as follows:
000001 VARSUB SCAN (!)
000002 VARSET CODE VALUE(YY)
000003 VARSET SUFFIX VALUE(1234)
000004 MODIFY CPOC ADID(MYAPPL) IA(1101241002)
000005 MODIFY CPOP OPNO(005) 
000006 MODIFY CPUSRF UFNAME(CODE) UFVALUE(XXYYZZ)
000007 MODIFY CPUSRF UFNAME(COMPOUND) UFVALUE(YY.1234)
000008 VARSUB NOSCAN
000009 MODIFY CPUSRF UFNAME(!OK) UFVALUE(It worked!!!)
Note:
  1. The VARSUB SCAN statement activates variable substitution.
  2. A user variable called CODE is set to YY.
  3. A user variable called SUFFIX is set to 1234.
  4. !OADID is resolved to the occurrence name, terminated by the closing parenthesis. !OYMD1 is resolved to the occurrence IA date, terminated by the prefix of the next variable. !OHHMM is resolved to the occurrence IA time, terminated by the closing parenthesis.
  5. !OOPNO is resolved to the number of the running operation, terminated by the period (.), which will not appear in the resolved command because it is the optional termination character. In this case, the period was not needed because the closing parenthesis terminates the variable name anyway.
  6. !CODE is resolved to YY, terminated by the period (.). In this case, the termination character is required to distinguish the variable name CODE from the subsequent ZZ characters. The termination character does not appear in the resolved statements (just like in JCL).
  7. !CODE is resolved to YY and !SUFFIX is resolved to 1234. In this case, the code and the suffix are to be intentionally separated by a period in the resolved statement, therefore a second period needs to be coded after the termination character (just like in JCL).
  8. The VARSUB NOSCAN statement deactivates variable substitution.
  9. Even though the last line contains !OK and other exclamation marks, because the variable substitution is turned off the statement is run as is. Hence, the result is a user field called !OK with the value “It worked!!!”

Dependent variables work slightly differently from how they work with HCL Workload Automation for Z JCL Tailoring. The target variable, on which the dependency is related to, does not need to have been previously referenced in prior Workload Automation Programming Language statements. Instead, Workload Automation Programming Language automatically searches for and loads the target variable, and if the target variable has a dependency it repeats the process, until a static variable is found. If dependent variables were coded so that the references are circular, the parsing fails and a message highlighting the variables in the loop is issued.