HLASM Language Reference
HLASM Language Reference HLASM Language Reference
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
- Page 272 and 273: Model Statements Notes: 1. You can
- Page 274 and 275: Positional Parameters Symbolic para
- Page 276 and 277: Processing Statements Processing St
- Page 278 and 279: AREAD Instruction Assign Local Time
- Page 280 and 281: COPY Instruction sequence_symbol is
- Page 282 and 283: System Variable Symbols System Vari
- Page 284 and 285: &SYSADATA_MEMBER System Variable Sy
- Page 286 and 287: &SYSCLOCK System Variable Symbol &S
- Page 288 and 289: &SYSECT System Variable Symbol depe
- Page 290 and 291: &SYSIN_MEMBER System Variable Symbo
- Page 292 and 293: &SYSJOB System Variable Symbol &SYS
- Page 294 and 295: &SYSLIN_DSN System Variable Symbol
- Page 296 and 297: &SYSLIST System Variable Symbol The
- Page 298 and 299: &SYSLOC System Variable Symbol To
- Page 300 and 301: &SYSM_SEV System Variable Symbol &S
- Page 302 and 303: &SYSNDX System Variable Symbol The
- Page 304 and 305: &SYSOPT_DBCS System Variable Symbol
- Page 306 and 307: &SYSPARM System Variable Symbol Not
- Page 308 and 309: &SYSPRINT_MEMBER System Variable Sy
- Page 310 and 311: &SYSPUNCH_MEMBER System Variable Sy
- Page 312 and 313: &SYSSTEP System Variable Symbol Not
- Page 314 and 315: &SYSTERM_DSN System Variable Symbol
- Page 316 and 317: &SYSTIME System Variable Symbol Not
- Page 318 and 319: Macro Instruction Format sequence_s
- Page 320 and 321: Macro Instruction Format Operand En
- Page 324 and 325: Sublists in Operands the order in w
- Page 326 and 327: Sublists in Operands &SYSLIST( n,m)
- Page 328 and 329: Values in Operands Notes: 1. Spaces
- Page 330 and 331: Values in Operands Parentheses In m
- Page 332 and 333: Inner and Outer Macro Instructions
- Page 334 and 335: Levels of Macro Call Nesting When t
- Page 336 and 337: Levels of Macro Call Nesting System
- Page 338 and 339: How to Write Conditional Assembly I
- Page 340 and 341: SET Symbols SET Symbol Specificatio
- Page 342 and 343: SET Symbols Figure 86 (Page 3 of 3)
- Page 344 and 345: Data Attributes this example indica
- Page 346 and 347: Data Attributes variable_symbol is
- Page 348 and 349: Data Attributes The value of an att
- Page 350 and 351: Data Attributes The following attri
- Page 352 and 353: Data Attributes Assembler gives a t
- Page 354 and 355: Data Attributes The scale attribute
- Page 356 and 357: Data Attributes Number Attribute (N
- Page 358 and 359: Data Attributes The operation code
- Page 360 and 361: Lookahead MACRO &NAME MOVE &TO,&FRO
- Page 362 and 363: Open Code Sequence Symbols The cond
- Page 364 and 365: GBLA, GBLB, and GBLC Instructions G
- Page 366 and 367: LCLA, LCLB, and LCLC Instructions s
- Page 368 and 369: SETA Instruction expression is an a
- Page 370 and 371: SETA Instruction | The logical-exp
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