User-defined variables

The enhanced 3270 user interface supports the use of user-defined variables. Variables can be created and set anywhere in a workspace definition using a SET statement. In addition, columns names specified using the KEYCOLS keyword in a previously invoked workspace can be used as variables in subsequent panels, without using a SET statement.
Variables can be set anywhere in a definition, but they are processed differently depending upon where the SET statement appears.
  • Variables set in an ALIASCOMMANDS stanza can be used in fastpath commands from that workspace, if SCOPE=LOCAL, or from any workspace after they have been defined until they are deleted, if SCOPE=GLOBAL.
  • Variables set in PROLOG stanzas are assigned during PROLOG execution. Assignment occurs after any imbeds and before data collection. If a REXX exec is also present, the SET commands are evaluated according to their placement, before, or after, the REXX EXEC call.
  • Variables set in EPILOG stanzas are assigned during EPILOG execution. Assignment occurs after data collection or status assessment and before the screen is constructed. If a REXX exec is also present, the SET commands are evaluated according to their placement, before, or after, the REXX EXEC call.
  • Variables set in an ONACTION stanza are executed directly after key column assignment, and just before any navigation that results from an action command. (Key columns are assigned before navigating forward if any action command is driven from a particular subpanel.)
  • Variables set anywhere else are processed when the workspace is loaded.
Variable names may consist of up to 16 characters.
Note: Do not create variables that begin with Z (or z). That letter is reserved for system variables.
Variable data may consist of up to 64 characters and can be set to specified values or to other variables. For example:
SET &var1=mytext
SET &var2=&colname
There is a limit of 20 deferred SET commands for a workspace. (Deferred SET commands are those in PROLOG, EPILOG, and ONACTION stanzas.)

Example: column names as variables

Column names specified using the KEYCOLS keyword in a previously invoked panel can be used as variables in subsequent panel definitions, without using a SET statement. For example, if the following column names have been set in a previous panel:

KEYCOLS='TRANID,USERID,TASKNO,TERMID,CICSNAME,SYSTEMID,ORIGINNODE'
one or more of these names can be used as variables in a header, query, or any text in a panel navigated to from the first panel. For example:

HEADER='Details for Transaction &TRANID Task &TASKNO'  
QUERY='SELECT TRANID, TASKNO, RTYPE, RNAME, STATE, CPUTIME, .SUSPTIME,   
ELAPTIME, CICSTRD.USEDA16, USEDB16,                
ATCHTIME, TIMEOFSU, SUSPDUE, FACTYPE, FACID, ORIGTRID, UMBTRID, 
QUEUE, FIRSTPGM, CURRPGM, USERID, EXECCMD, PURGEABL, PURGSTAT,
SUSPTYPE, UOWSTATE, 
FROM OMCICS.CICSTRD,
WHERE ORIGINNODE = "&SYSTEMID.&CICSNAME"
AND CICSTRD.TRANID = "&TRANID"
AND CICSTRD.TASKNO = "&TASKNO"'.