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

Macro Instruction Format When you need to change the default value, you must use the corresponding keyword operand in the macro instruction. The keyword can indicate the purpose for which the passed value is used. Any keyword operand specified in a macro instruction must correspond to a keyword parameter in the macro definition called. However, keyword operands do not have to be specified in any particular order. The general specifications for symbolic parameters also apply to keyword operands. The actual operand keyword must be a valid variable symbol. A null character string can be specified as the standard value of a keyword operand, and is generated if the corresponding keyword operand is omitted. A keyword operand must be coded in this format: KEYWORD=VALUE where: KEYWORD has up to 62 characters without an ampersand. | VALUE can be up to 1024 characters. The corresponding keyword parameter in the called macro definition is specified as: &KEYWORD=DEFAULT If a keyword operand is specified, its value overrides the default value specified for the corresponding keyword parameter. If the DBCS assembler option is specified, the keyword operand can be a string containing double-byte data. The string need not be quoted. If the value of a keyword operand is a literal, two equal signs must be specified. The following examples of macro instructions have keyword operands: MACKEY KEYWORD=(A,B,C,D,E) MACKEY KEY1=1,KEY2=2,KEY3=3 MACKEY KEY3=2,KEY1=,KEYWORD=HALLO MACKEY KEYWORD='' MACKEY KEYWORD==C'STRING' To summarize the relationship of keyword operands to keyword parameters: The keyword of the operand corresponds (see ▌1▐ in Figure 78 on page 303) to a keyword parameter. The value in the operand overrides the default value of the parameter. If the keyword operand is not specified (see ▌2▐ in Figure 78), the default value of the parameter is used. If the keyword of the operand does not correspond (see ▌3▐ in Figure 78) to any keyword parameter, the assembler issues an error message, but the macro is generated using the default values of the other parameters. The default value specified for a keyword parameter can be the null character string (see ▌4▐ in Figure 78). The null character string is a character string with a length of zero; it is not a space, because a space occupies one character position. 302 HLASM V1R5 Language Reference

Macro Instruction Format ┌─ ▌4▐ Null character string │ is default value MACRO ▼ MACCORR &KEY1=DEFAULT,&KEY2=,&KEY3=123 . . DC C'&KEY1&KEY2&KEY3' . . MEND ─────────────────────────────────────────────────────────────── OPEN START . . ▌1▐ ▌1▐ ▌1▐ MACCOOR KEY1=OVERRIDE,KEY2=,KEY3=456 . │ │ │ . ┌────┘ ┌──────────┘ │ . ▼ ▼ │ + DC C'OVERRIDE456' │ . ▲ │ . └────────────────┘ . MACCOOR ▌2▐ . ┌──── KEY2 has null character . │ string as default . ▼ + DC C'DEFAULT123' . . . ▌3▐ MACCOOR KEY4=SYMBOL,KEY2= ASMA17W WARNING Undefined keyword parameter . . . . . . + DC C'DEFAULT123' . . . MACCOOR KEY1=,KEY3=456 . ┌──────────────────── KEY1 parameter has null . │ character string value . ▼ KEY2 has null character + DC C'456' string as default END Figure 78. Relationship between Keyword Operands and Keyword Parameters and Their Assigned Values Combining Positional and Keyword Operands You can use positional and keyword operands in the same macro instruction. Use a positional operand for a value that you change often, and a keyword operand for a value that you change infrequently. Positional and keyword parameters can be mixed freely in the macro prototype statement (see ▌1▐ in Figure 79). The same applies to the positional and keyword operands of the macro instruction (see ▌2▐ in Figure 79). Note, however, that the order in which the positional parameters appear (see ▌3▐ in Figure 79) determines Chapter 8. How to Write Macro Instructions 303

Macro Instruction Format<br />

┌─ ▌4▐ Null character string<br />

│ is default value<br />

MACRO<br />

▼<br />

MACCORR &KEY1=DEFAULT,&KEY2=,&KEY3=123<br />

.<br />

.<br />

DC C'&KEY1&KEY2&KEY3'<br />

.<br />

.<br />

MEND<br />

───────────────────────────────────────────────────────────────<br />

OPEN START <br />

.<br />

. ▌1▐ ▌1▐ ▌1▐<br />

MACCOOR KEY1=OVERRIDE,KEY2=,KEY3=456<br />

. │ │ │<br />

. ┌────┘ ┌──────────┘ │<br />

. ▼ ▼ │<br />

+ DC C'OVERRIDE456' │<br />

. ▲ │<br />

. └────────────────┘<br />

.<br />

MACCOOR ▌2▐<br />

. ┌──── KEY2 has null character<br />

. │ string as default<br />

. ▼<br />

+ DC C'DEFAULT123'<br />

.<br />

.<br />

. ▌3▐<br />

MACCOOR KEY4=SYMBOL,KEY2=<br />

ASMA17W WARNING Undefined keyword parameter . . .<br />

.<br />

.<br />

.<br />

+ DC C'DEFAULT123'<br />

.<br />

.<br />

.<br />

MACCOOR KEY1=,KEY3=456<br />

. ┌──────────────────── KEY1 parameter has null<br />

. │ character string value<br />

. ▼ KEY2 has null character<br />

+ DC C'456' string as default<br />

END<br />

Figure 78. Relationship between Keyword Operands and Keyword Parameters and Their<br />

Assigned Values<br />

Combining Positional and Keyword Operands<br />

You can use positional and keyword operands in the same macro instruction. Use<br />

a positional operand for a value that you change often, and a keyword operand for<br />

a value that you change infrequently.<br />

Positional and keyword parameters can be mixed freely in the macro prototype<br />

statement (see ▌1▐ in Figure 79). The same applies to the positional and keyword<br />

operands of the macro instruction (see ▌2▐ in Figure 79). Note, however, that the<br />

order in which the positional parameters appear (see ▌3▐ in Figure 79) determines<br />

Chapter 8. How to Write Macro Instructions 303

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

Saved successfully!

Ooh no, something went wrong!