HLASM Language Reference

HLASM Language Reference HLASM Language Reference

faculty.cs.niu.edu
from faculty.cs.niu.edu More from this publisher
22.02.2015 Views

Values in Operands Parentheses In macro instruction operand values, there must be an equal number of left and right parentheses. They must be paired, that is, each left parenthesis needs a following right parenthesis at the same level of nesting. An unpaired (single) left or right parenthesis can appear only in a quoted string. Examples: (PAIRED-PARENTHESES) () (A(B)C)D(E) (IN'('STRING) Spaces One or more spaces outside a quoted string indicates the end of the operands of a macro instruction. Thus spaces should only be used inside quoted strings. Example: 'SPACES ALLOWED' Commas A comma outside a quoted string indicates the end of an operand value or sublist entry. Commas that do not delimit values can appear inside quoted strings or paired parentheses that do not enclose sublists. Examples: A,B,C,D (1,2)3'5,6' Equal Signs An equal sign can appear in the value of a macro instruction operand or sublist entry: As the first character Inside quoted strings Between paired parentheses In a keyword operand In a positional operand, provided the parameter does not resemble a keyword operand Examples: =H'21' A'='B C(A=B) 2X=B KEY=A=B The assembler issues a warning message for a positional operand containing an equal sign, if the operand resembles a keyword operand. Thus, if we assume that the following is the prototype of a macro definition: MAC1 &F the following macro instruction generates a warning message: MAC1 K=L (K appears to be a valid keyword) 310 HLASM V1R5 Language Reference

Nesting Macro Instruction Definitions while the following macro instruction does not: MAC1 2+2=4 (2+2 is not a valid keyword) Periods A period (.) can be used in the value of an operand or sublist entry. It is passed as a period. However, if it is used immediately after a variable symbol, it becomes a concatenation character. Two periods are required if one is to be passed as a character. Examples: 3.4 &A.1 &A..1 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. Note that 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. This lack of parameterization can be overcome in some cases by using the AINSERT statement. This lets you generate a macro definition from within another macro generation. A simple example is shown at “Where to Define a Macro in a Source Module” on page 243. In Figure 83 on page 312, macro 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. Chapter 8. How to Write Macro Instructions 311

Nesting Macro Instruction Definitions<br />

while the following macro instruction does not:<br />

MAC1 2+2=4 (2+2 is not a valid keyword)<br />

Periods<br />

A period (.) can be used in the value of an operand or sublist entry. It is passed as<br />

a period. However, if it is used immediately after a variable symbol, it becomes a<br />

concatenation character. Two periods are required if one is to be passed as a<br />

character.<br />

Examples:<br />

3.4<br />

&A.1<br />

&A..1<br />

Nesting Macro Instruction Definitions<br />

A nested macro instruction definition is a macro instruction definition you can<br />

specify as a set of model statements in the body of an enclosing macro definition.<br />

This lets you create a macro definition by expanding the outer macro that contains<br />

the nested definition.<br />

Note that all nested inner macro definitions are effectively “black boxes”: there is no<br />

visibility to the outermost macro definition of any variable symbol or sequence<br />

symbol within any of the nested macro definitions. This means that you cannot use<br />

an enclosing macro definition to tailor or parameterize the contents of a nested<br />

inner macro definition.<br />

This lack of parameterization can be overcome in some cases by using the<br />

AINSERT statement. This lets you generate a macro definition from within another<br />

macro generation. A simple example is shown at “Where to Define a Macro in a<br />

Source Module” on page 243. In Figure 83 on page 312, macro<br />

ainsert_test_macro generates the macro mac1 using a combination of AINSERT<br />

and AREAD instructions. The mac1 macro is then called with a list of seven<br />

parameters.<br />

Chapter 8. How to Write Macro Instructions 311

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

Saved successfully!

Ooh no, something went wrong!