The VARSUB tag specifies a variable to
substitute in message text.
Syntax
>>-<VARSUB--VAR=variable-name-->--+-----------+----------------><
'-</VARSUB>-'
Parameters
- VAR=variable-name
- This
attribute specifies the variable whose value is substituted within
the message.
The variable-name should
be declared with a VARDCL tag.
The variable-name must
follow the standard naming convention described in Rules for variable names.
Comments
The
VARSUB tag specifies a variable to substitute in message text. You
use the required VAR attribute to specify the variable whose value
is resolved and inserted into the message text when the message is
displayed. The value coded must be a variable name without leading
% notation.
You can code the VARSUB tag in the message-text of
a MSG tag. The variable value is inserted by ISPF at run time at the
position in the message text where the VARSUB tag is coded.
For
example, assume this VARSUB tag was coded within the text of this
message:
<msgmbr name=abca00>
<msg suffix=1 msgtype=warning>Invalid name,
“<VARSUB VAR=LASTN>”, specified.
The name may contain only alphabetic characters.
</msgmbr>
When a dialog refers to a message
abca001 (with
a GETMSG, SETMSG, DISPLAY, or TBDISPL service call) or the message
is displayed by ISPF during panel validation, the value of
lastn is
retrieved and inserted into the message text. Here is the message
after substitution:
Invalid name, “Jones1”, specified.
The name may contain only alphabetic characters.
Restrictions
- You must code the VARSUB tag within the text of a MSG definition.
See MSG (Message) for a complete description
of this tag.
- The value specified by the VAR attribute should be declared with
a VARDCL tag. See VARDCL (Variable Declaration) for a
complete description of this tag.
Examples
Here
is markup that contains a message member which contains nine MSG definitions.
The text of messages
MSGV883 and
MSGV888 contain variable
substitutions.
Figure 1 shows the generated
message member.
<!DOCTYPE DM SYSTEM>
<VARCLASS NAME=msgcls TYPE='char 20'>
<VARLIST>
<VARDCL NAME=phoneno VARCLASS=msgcls>
<VARDCL NAME=cnum VARCLASS=msgcls>
</VARLIST>
<MSGMBR NAME=msgv88>
<MSG SUFFIX=1>Name must be alphabetic.
<MSG SUFFIX=2>Enter only number of days.
<MSG SUFFIX=3 MSGTYPE=critical>The only rooms we have available
are either SINGLE or DOUBLE. Please call the manager of the hotel
who will arrange equivalent lodging at another
hotel in the area. This is our mistake, and we will, of course,
pick up the bill. Please call collect <VARSUB VAR=phoneno>.
<MSG SUFFIX=4 MSGTYPE=action LOCATION=modal>Please enter either
BIGCHARGE, V I S T A, EZCARD, CHECK, or CASH.
<MSG SUFFIX=5 MSGTYPE=warning LOCATION=modeless>Please enter your name.
<MSG SUFFIX=6>Please enter Y or N.
<MSG SUFFIX=7>Card number is a seven-digit number.
<MSG SUFFIX=8 MSGTYPE=warning>The card number you
entered, <VARSUB VAR=cnum> is not valid.
<MSG SUFFIX=9>Message '9' contains embedded quotes.
</MSGMBR>
Figure 1. Variable substitutionMSGV881 .TYPE=NOTIFY
'Name must be alphabetic.'
MSGV882 .TYPE=NOTIFY
'Enter only number of days.'
MSGV883 .TYPE=CRITICAL
'The only rooms we have available are either SINGLE or DOUBLE. Please call th' +
'e manager of the hotel who will arrange equivalent lodging at another hotel ' +
'in the area. This is our mistake, and we will, of course, pick up the bill. ' +
'Please call collect &PHONENO.'
MSGV884 .TYPE=ACTION .WINDOW=RESP
'Please enter either BIGCHARGE, V I S T A, EZCARD, CHECK, or CASH.'
MSGV885 .TYPE=WARNING .WINDOW=NORESP
'Please enter your name.'
MSGV886 .TYPE=NOTIFY
'Please enter Y or N.'
MSGV887 .TYPE=NOTIFY
'Card number is a seven-digit number.'
MSGV888 .TYPE=WARNING
'The card number you entered, &CNUM is not valid.'
MSGV889 .TYPE=NOTIFY
'Message '9'' contains embedded quotes.'