|
Use &SYSLIST instead of a positional parameter inside a macro
definition; for example, as a point of substitution. By varying the
subscripts attached to &SYSLIST, you can refer to any sublist
entry in a macro call operand, or any positional
operands in a macro call. You can also refer to positional operands
for which no corresponding positional parameter is specified in the
macro prototype statement.
The local-scope system variable symbol &SYSLIST is assigned
a read-only value each time a macro definition is called.
&SYSLIST refers to the complete list of positional operands
specified in a macro instruction. &SYSLIST does not refer to
keyword operands. However, &SYSLIST cannot be specified as &SYSLIST
without a subscript. One of the two following forms must be used for
references or as a point of substitution: - &SYSLIST(n) can be used to refer
to the n-th positional operand
- If the n-th operand is a sublist, then &SYSLIST(n,m)
can be used to refer to the m-th operand
in the sublist.
- When referring to multilevel (nested) sublists in operands of
macro instructions, refer to elements of inner sublists by using the
applicable number of subscripts for &SYSLIST.
The subscripts n and m can
be any arithmetic expression allowed in the operand of a SETA instruction
(See SETA instruction). The subscript n must
be greater than or equal to 0. The subscript m and
any additional subscripts after m must be
greater than or equal to 1.
The examples show the values assigned to &SYSLIST according
to the value of its subscripts n and m.
Macro instruction:
------------------
NAME MACALL ONE,TWO,(3,(4,5,6),,8),,TEN,()
Use Within a
Macro Definition: Value See note:
--------------------- ------------ ---------
&SYSLIST(2) TWO
&SYSLIST(3,1) 3
&SYSLIST(3,2,2) 5
&SYSLIST(4) Null 1
&SYSLIST(12) Null 1
&SYSLIST(3,3) Null 2
&SYSLIST(3,5) Null 2
&SYSLIST(2,1) TWO 3
&SYSLIST(2,2) Null
&SYSLIST(0) NAME 4
&SYSLIST(3) (3,(4,5,6),,8)
&SYSLIST(11) ()
&SYSLIST(11,1) Null 2
Note: - If the position indicated by n refers
to an omitted operand, or refers to an entry past the end of the list
of positional operands specified, the null character string is substituted
for &SYSLIST(n).
- If the position (in a sublist) indicated by the second subscript, m,
refers to an omitted entry, or refers past the end of the list of
entries specified in the sublist referred to by the first subscript n,
the null character string is substituted for &SYSLIST(n,m).
- If the n-th positional operand is not
a sublist, &SYSLIST(n,1) refers to the
operand. However, &SYSLIST(n,m),
where m is greater than 1, causes the null
character string to be substituted.
- If the value of subscript n is 0, then &SYSLIST(n)
is assigned the value specified in the name field of the macro instruction,
except when it is a sequence symbol.
Attribute references can be made to the previously described forms
of &SYSLIST. The attributes are the attributes inherent in the
positional operands or sublist entries to which you refer. However,
the number attribute of &SYSLIST (N'&SYSLIST) is different
from the number attribute described in Data attributes.
One of two forms can be used for the number attribute: - To indicate the number of positional operands specified in a call,
use the form N'&SYSLIST.
- To indicate the number of sublist entries that have been specified
in a positional operand, use the form N'&SYSLIST(n).
- To indicate the number of entries in nested sublists, specify
the appropriate set of subscripts need to reference the selected sublist.
Notes: - N'&SYSLIST includes any positional operands that are omitted.
Positional operands are omitted by coding a comma where an operand
is expected.
- N'&SYSLIST(n) includes those sublist
entries specifically omitted by specifying the comma that normally
follows the entry.
- If the operand indicated by n is not
a sublist, N'&SYSLIST(n) is 1. If it
is omitted, N'&SYSLIST(n) is 0.
The COMPAT(SYSLIST) assembler option instructs the assembler to treat sublists in macro instruction
operands as character strings, not sublists. See the section "COMPAT" in
the HLASM Programmer's Guide for
a description of the COMPAT(SYSLIST) assembler option.
Examples of sublists: Macro Instruction N'&SYSLIST
MACLST 1,2,3,4 4
MACLST A,B,,D,E 5
MACLST ,A,B,C,D 5
MACLST (A,B,C),(D,E,F) 2
MACLST 0
MACLST KEY1=A,KEY2=B 0
MACLST A,B,KEY1=C 2
N'&SYSLIST(2)
MACSUB A,(1,2,3,4,5),B 5
MACSUB A,(1,,3,,5),B 5
MACSUB A,(,2,3,4,5),B 5
MACSUB A,B,C 1
MACSUB A,,C 0
MACSUB A,(),C 1
MACSUB A,KEY=(A,B,C) 0
MACSUB 0
|