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

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

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

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

Saved successfully!

Ooh no, something went wrong!