11.07.2015 Views

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

HLASM: V1R6 Language Ref

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Nesting macro instruction definitionsNote that all nested inner macro definitions are effectively “black boxes”: there isno visibility to the outermost macro definition of any variable symbol or sequencesymbol within any of the nested macro definitions. This means that you cannot usean enclosing macro definition to tailor or parameterize the contents of a nestedinner macro definition.This lack of parameterization can be overcome in some cases by using theAINSERT statement. This lets you generate a macro definition from within anothermacro generation. A simple example is shown at “Where to define a macro in asource module” on page 241. In Figure 33, macro ainsert_test_macro generates themacro mac1 using a combination of AINSERT and AREAD instructions. The mac1macro is then called with a list of seven parameters.1 macro2 &name ainsert_test_macro3 ainsert ’ Macro’,back4 ainsert ’ mac1’,back5 ainsert ’Blah blah blah’,front6 &aread aread7 &aread setc ’&aread’(1,10)8 ainsert ’&&n seta n’’&&syslist ’,back9 ainsert ’ dc a(&&n)’,back10 ainsert ’ dc c’’&aread’’ ’,back11 ainsert ’ mend’,back12 mend13 *14 testains csect 015 *16 ainsert_test_macro17+ ainsert ’ Macro’,back18+ ainsert ’ mac1’,back19+ ainsert ’Blah blah blah’,front20-Blah blah blah21+ ainsert ’&&n seta n’’&&syslist ’,back22+ ainsert ’ dc a(&&n)’,back23+ ainsert ’ dc c’’Blah blah ’’ ’,back24+ ainsert ’ mend’,back25> Macro26> mac127>&n seta n’&syslist28> dc a(&n)29> dc c’Blah blah ’30> mend31 *32 mac1 a,b,c,d,e,f,g33+ dc a(7)34+ dc c’Blah blah ’35 *36 endFigure 33. Expanding nested macro definitionsInner and outer macro instructionsAny macro instruction you write in the open code of a source module is an outermacro instruction or call. Any macro instruction that appears within a macrodefinition is an inner macro instruction or call.Chapter 8. How to write macro instructions 309

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!