HLASM Language Reference
HLASM Language Reference HLASM Language Reference
How to Write Conditional Assembly Instructions Chapter 9. How to Write Conditional Assembly Instructions This chapter describes the conditional assembly language. With the conditional assembly language, you can carry out general arithmetic and logical computations, and many of the other functions you can carry out with any other programming language. Also, by writing conditional assembly instructions in combination with other assembler language statements, you can: Select sequences of these source statements, called model statements, from which machine and assembler instructions are generated Vary the contents of these model statements during generation The assembler processes the instructions and expressions of the conditional assembly language during conditional assembly processing. Then, at assembly time, it processes the generated instructions. Conditional assembly instructions, however, are not processed after conditional assembly processing is completed. The conditional assembly language is more versatile when you use it to interact with symbolic parameters and the system variable symbols inside a macro definition. However, you can also use the conditional assembly language in open code; that is, code that is not within a macro definition. Elements and Functions The elements of the conditional assembly language are: SET symbols that represent data. See “SET Symbols” on page 319. Attributes that represent different characteristics of symbols. See “Data Attributes” on page 324. Sequence symbols that act as labels for branching to statements during conditional assembly processing. See “Sequence Symbols” on page 339. The functions of the conditional assembly language are: Declaring SET symbols as variables for use locally and globally in macro definitions and open code. See “Declaring SET Symbols” on page 343. Assigning values to the declared SET symbols. See “Assigning Values to SET Symbols” on page 347. Selecting characters from strings for substitution in, and concatenation to, other strings; or for inspection in condition tests. See “Substring Notation” on page 371. Branching and exiting from conditional assembly loops. See “Branching” on page 390. The conditional assembly language can also be used in open code with few restrictions. See “Open Code” on page 342. The conditional assembly language provides instructions for evaluating conditional assembly expressions used as values for substitution, as subscripts for variable symbols, and as condition tests for branching. See “Conditional Assembly Instructions” on page 343 for details about the syntax and usage rules of each instruction. 318 © Copyright IBM Corp. 1982, 2004
SET Symbols SET Symbols SET symbols are variable symbols that provide you with arithmetic, binary, or character data, and whose values you can vary during conditional assembly processing. Use SET symbols as: Terms in conditional assembly expressions Counters, switches, and character strings Subscripts for variable symbols Values for substitution Thus, SET symbols let you control your conditional assembly logic, and to generate many different statements from the same model statement. Subscripted SET Symbols You can use a SET symbol to represent a one-dimensional array of many values. You can then refer to any one of the values of this array by subscripting the SET symbol. For more information, see “Subscripted SET Symbol Specification” on page 322. Scope of SET Symbols The scope of a SET symbol is that part of a program for which the SET symbol has been declared. Local SET symbols need not be declared by explicit declarations. The assembler considers any undeclared variable symbol found in the name field of a SETx instruction as a local SET symbol. If you declare a SET symbol to have a local scope, you can use it only in the statements that are part of either: The same macro definition, or Open code If you declare a SET symbol to have a global scope, you can use it in the statements that are part of any one of: The same macro definition A different macro definition Open code You must, however, declare the SET symbol as global for each part of the program (a macro definition or open code) in which you use it. You can change the value assigned to a SET symbol without affecting the scope of this symbol. Scope of Symbolic Parameters A symbolic parameter has a local scope. You can use it only in the statements that are part of the macro definition for which the parameter is declared. You declare a symbolic parameter in the prototype statement of a macro definition. The scope of system variable symbols is described in Figure 86 on page 320. Chapter 9. How to Write Conditional Assembly Instructions 319
- 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 322 and 323: Macro Instruction Format When you n
- 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 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
- Page 372 and 373: SETA Instruction | Figure 99 (Page
- Page 374 and 375: SETA Instruction | The result of C2
- Page 376 and 377: SETA Instruction NOT Format: Logica
- Page 378 and 379: SETA Instruction | X2A Name Operati
- Page 380 and 381: SETA Instruction In evaluating the
- Page 382 and 383: SETB Instruction Any expression tha
- Page 384 and 385: SETB Instruction ┌─────
- Page 386 and 387: SETB Instruction | ISDEC | Format:
How to Write Conditional Assembly Instructions<br />
Chapter 9. How to Write Conditional Assembly Instructions<br />
This chapter describes the conditional assembly language. With the conditional<br />
assembly language, you can carry out general arithmetic and logical computations,<br />
and many of the other functions you can carry out with any other programming<br />
language. Also, by writing conditional assembly instructions in combination with<br />
other assembler language statements, you can:<br />
Select sequences of these source statements, called model statements, from<br />
which machine and assembler instructions are generated<br />
Vary the contents of these model statements during generation<br />
The assembler processes the instructions and expressions of the conditional<br />
assembly language during conditional assembly processing. Then, at assembly<br />
time, it processes the generated instructions. Conditional assembly instructions,<br />
however, are not processed after conditional assembly processing is completed.<br />
The conditional assembly language is more versatile when you use it to interact<br />
with symbolic parameters and the system variable symbols inside a macro<br />
definition. However, you can also use the conditional assembly language in open<br />
code; that is, code that is not within a macro definition.<br />
Elements and Functions<br />
The elements of the conditional assembly language are:<br />
SET symbols that represent data. See “SET Symbols” on page 319.<br />
Attributes that represent different characteristics of symbols. See “Data<br />
Attributes” on page 324.<br />
Sequence symbols that act as labels for branching to statements during<br />
conditional assembly processing. See “Sequence Symbols” on page 339.<br />
The functions of the conditional assembly language are:<br />
Declaring SET symbols as variables for use locally and globally in macro<br />
definitions and open code. See “Declaring SET Symbols” on page 343.<br />
Assigning values to the declared SET symbols. See “Assigning Values to SET<br />
Symbols” on page 347.<br />
Selecting characters from strings for substitution in, and concatenation to, other<br />
strings; or for inspection in condition tests. See “Substring Notation” on<br />
page 371.<br />
Branching and exiting from conditional assembly loops. See “Branching” on<br />
page 390.<br />
The conditional assembly language can also be used in open code with few<br />
restrictions. See “Open Code” on page 342.<br />
The conditional assembly language provides instructions for evaluating conditional<br />
assembly expressions used as values for substitution, as subscripts for variable<br />
symbols, and as condition tests for branching. See “Conditional Assembly<br />
Instructions” on page 343 for details about the syntax and usage rules of each<br />
instruction.<br />
318 © Copyright IBM Corp. 1982, 2004