Nesting macro instruction definitions
A nested macro instruction definition is a macro instruction definition you can specify as a set of model statements in the body of an enclosing macro definition. This lets you create a macro definition by expanding the outer macro that contains the nested definition.
All nested inner macro definitions are effectively black boxes
:
there is no visibility to the outermost macro definition of any variable
symbol or sequence symbol within any of the nested macro definitions.
This means that you cannot use an enclosing macro definition to tailor
or parameterize the contents of a nested inner macro definition.

First MAC1
is edited, and MAC2
and MAC3
are
not. When MAC1
is called, MAC2
is
edited (unless its definition is bypassed by an AIF or AGO branch);
when MAC2
is called, MAC3
is edited.
No macro can be called until it has been edited.
There is no limit to the number of nestings allowed for inner macro definitions.
ainsert_test_macro
generates the macro mac1
using a combination of
AINSERT and AREAD instructions. The mac1
macro is then called with a list of seven
parameters. 1 macro 2 &name ainsert_test_macro 3 ainsert ' Macro',back 4 ainsert ' mac1',back 5 ainsert 'Blah blah blah',front 6 &aread aread 7 &aread setc '&aread'(1,10) 8 ainsert '&&n seta n''&&syslist ',back 9 ainsert ' dc a(&&n)',back 10 ainsert ' dc c''&aread'' ',back 11 ainsert ' mend',back 12 mend 13 * 14 testains csect 0 15 * 16 ainsert_test_macro 17+ ainsert ' Macro',back 18+ ainsert ' mac1',back 19+ ainsert 'Blah blah blah',front 20-Blah blah blah 21+ ainsert '&&n seta n''&&syslist ',back 22+ ainsert ' dc a(&&n)',back 23+ ainsert ' dc c''Blah blah '' ',back 24+ ainsert ' mend',back 25> Macro 26> mac1 27>&n seta n'&syslist 28> dc a(&n) 29> dc c'Blah blah ' 30> mend 31 * 32 mac1 a,b,c,d,e,f,g 33+ dc a(7) 34+ dc c'Blah blah ' 35 * 36 end