Variables in REXX EXECs


This section describes how variables are passed to BMC AMI Ops Automation REXX EXECs.

Complex EXECs must be able to do much more than issue commands and return control to their callers.

An EXEC must be able to request information from BMC AMI OpsA (and other products), compare the information, compare the time elapsed since the last observation, and effect changes that other EXECs or products carry out.

This type of logic requires the ability to save information, either temporarily or permanently, in a simple manner so that it can be accessed later by the same EXEC or other EXECs.

To retain this information for EXECs, BMC AMI OpsA provides four kinds of variables and variable pools.


Variable pool name

Description

TSO variables

Exists for the life of the EXEC

TSO variables include

  • TSO variables that are supplied by BMC AMI OpsA
  • Modifiable TSO variables
  • Nonmodifiable TSO variables

LOCAL variables

Are stored in a pool that can be accessed only by the current EXEC and other EXECs in the same thread (using IMFEXEC SELECT WAIT(YES))

BMC AMI OpsA passes information to an EXEC in this pool. It is also used by AOAnywhere when sharing variables with an invoking EXEC. The LOCAL variable pool is freed when the EXEC ends and its contents are lost.

Two types of GLOBAL variable pools: SHARED and PROFILE

Can be saved for later executions of the same EXEC or other EXECs

GLOBAL variables refers to both SHARED and PROFILE variables.

SHARED variables

SHARED variables are stored in a pool that is accessible to all EXECs in the BBI-SS PAS. They can be read, modified, created and deleted by any number of EXECs or Rules. Because EXECs can access them simultaneously, their access should be serialized (see IMFEXEC VENQ and VDEQ). These variables exist in storage beyond the life of the EXEC that created them.

BMC AMI OpsA creates a number of SHARED variables that contain system-specific information. SHARED variables are accessible to the Rules Processor and remain in memory when the subsystem is terminated. However, they are lost across IPLs or when a subsystem is restarted with the VPOOL=RESET option.

PROFILE variables

PROFILE variables are similar to SHARED variables with the exception that they are persistent across IPLs and their contents are never lost unless explicitly deleted.

PROFILE variables are not accessible from Rules.

Note

Variable names must be at least 1 and not more than 32 characters in length. The contents of any variable cannot exceed 256 characters.

BMC AMI OpsA also provides four IMFEXEC commands for defining, saving, deleting, and retrieving variables that use the different variable pools: 

IMFEXEC command

Description

VDCL

Defines map lists for variables

VPUT

Save variables to a pool

VPUTL

Saves long variables (up to 32 k and 30 characters long) to a pool

VGET

Retrieve variables from a pool

VGETL

Retrieves long variables (up to 32 k and 30 characters long) to a pool

VDEL

Remove variables from pools

VDELL

Removes long variables (up to 32 k and 30 characters long) to a pool

 Although three of these commands are similar to three ISPF Dialog commands, they are not identical. See Using-the-IMFEXEC-statements for coding details and carefully review the differences before using them.

LOCAL, SHARED and PROFILE variables (in this order) impose a cost to processing overhead, which means that the system uses more resources to preserve the contents of a PROFILE variable than for a LOCAL variable.

LOCAL, SHARED and PROFILE pool variables each come in two lengths: long and short. Short variables are limited to 255 characters in length and their names to 32 characters long. You cannot manipulate a variable with longer content by using the IMFEXEC VGET/VPUT/VDEL statements.

Long variables can be up to 32 K in length and have a variable name length up to 30 characters. These variables are manipulated by using the VGETL/VPUTL/VDELL IMFEXEC statements. Long and short variables are completely independent from each other. A variable that has been set with the VPUT statement cannot be read with the VGETL statements.

Long variables impose greater processing overhead than short variables. If your code, for example, has to remember only the names of persons, you should always choose a short variable. However, if a variable can possibly grow in length beyond the 255 character limit (say, you want to concatenation hundreds of volsers into one variable), you should use the long variable format.

In addition:

  • REXX EXECs cannot use any variables that have not been explicitly retrieved into the function pool by using IMFEXEC VGET(L) statements.
  • A variable with the same name but of a different type (long or short) or in different pools (LOCAL/SHARED/PROFILE) can contain completely separate values.
  • A LONG variable (set with the VPUTL statement) cannot be retrieved with a short variable operation (VGET) even if the contents of the explicit LONG variable does not exceed the 255 character limit.

REXX EXEC example:

Fred='This is a test'
"IMFEXEC VPUT FRED"
"IMFEXEC VGETL FRED"

CLIST example:

SET &FRED = &STR(This is a test)
IMFEXEC VPUT FRED
IMFEXEC VGETL FRED

The REXX EXEC statements yield the following result:

Fred='My name is Fred'
"IMFEXEC VPUT FRED"
Fred='My name is Flintstone'
"IMFEXEC VPUTL FRED"

The CLIST statements yield the following result:

SET &FRED = &STR(My name is Fred)
IMFEXEC VPUT FRED
SET &FRED = &STR(My name is Flintstone)
IMFEXEC VPUTL FRED

In this case, the variable Fred exists both as a long and a short variable, with different contents.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*