Custom screen recognition using global variables
- Verify that a global variable exists
- Verify that a global variable does not exist
- Verify the integer or string value of a global variable
- <customreco id="com.ibm.hats.common.customlogic.GlobalVariableScreenReco::{variable(name,option,resource, index)}COMPARE{type(name,option,resource, index)}" invertmatch="false" optional="false"/>
- <customreco id="com.ibm.hats.common.customlogic.GlobalVariableScreenReco:: {variable(name,option,resource, index)}COMPARE{type(value)}" invertmatch="false" optional="false"/>
Braces {} are used to contain each of the two items that are being compared. The first item is a ZIETrans global variable, whose name is specified in name. You can use option to specify that you want to use the variable's value, length, or existence in your comparison. The resource and index settings are optional. Use resource to indicate whether the global variable is local (which is the default) or shared. Use index to indicate which value to use from an indexed global variable.
- Another ZIETrans global variable, with similar options, in which case the first format is used
- A fixed value, in which case the second format is used
Setting | Valid values |
---|---|
type |
|
COMPARE |
|
options |
|
resource |
|
index | Any positive integer or 0 |
The following example compares the values of two local global variables:
<customreco id="com.ibm.hats.common.customlogic.GlobalVariableScreenReco::
{variable(name=gv1,option=value,resource=local)}EQUAL
{variable(name=gv2,option=value,resource=local)}"
invertmatch="false" optional="false"/>
This expression evaluates to true if the values of gv1 and gv2 are the same.
Now consider the length option. For a non-indexed global variable, length is the length of the value of the variable. For an indexed global variable, if you specify an index, length is the length of that index of the global variable; if you do not specify an index, length is the number of indexed entries in the global variable.
<customreco id="com.ibm.hats.common.customlogic.GlobalVariableScreenReco::
{variable(name=gv1,option=length,resource=shared)}LESSTHANOREQUAL
{variable(name=gv2,option=length,index=4)}" invertmatch="false" optional="false"/>
This expression compares the length of gv1 to the length of the fourth index of gv2. It evaluates to true if the length of gv1 is less than or equal to the length of the fourth index of gv2. You can use LESSTHANOREQUAL because length returns an integer value.
The use of resource=shared on gv1 in this example indicates that gv1 is a shared global variable. The other option is resource=local, which is the default, and means that the global variable is not shared with other applications.
You do not have to compare one global variable with another. You can compare the length of a global variable with a fixed integer. You can compare the value of a global variable with another string. For example:
<customreco id="com.ibm.hats.common.customlogic.GlobalVariableScreenReco::
{variable(name=gv1,option=value)}EQUAL{string(value=mystring)}"
invertmatch="false" optional="false"/>
This expression compares the value of gv1 with the string that is contained in mystring. The string can be a fixed string, the value of a variable, or a value that is returned from a method call. In general, you do not need to use custom logic to compare the length or value of a global variable to a fixed value; you can add these comparisons using the Global Variable Logic panel.