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

SETB Instruction The two comparands in a character relation are compared, character by character, according to binary (EBCDIC) representation of the characters. If two comparands in a relation have character values of unequal length, the assembler always takes the shorter character value to be less. 3. The assembler carries out logical operations from left to right. However, a. It carries out logical NOTs before logical ANDs, ORs and XORs b. It carries out logical ANDs before logical ORs and XORs c. It carries out logical ORs before logical XORs 4. In parenthesized logical expressions, the assembler evaluates the innermost expressions first, and then considers them as logical terms in the next outer level of expressions. It continues this process until it evaluates the outermost expression. Using SETB Symbols: The logical value assigned to a SETB symbol is used for the SETB symbol appearing in the operand field of an AIF instruction or another SETB instruction. If a SETB symbol is used in the operand field of a SETA instruction, or in arithmetic relations in the operand fields of AIF and SETB instructions, the binary values 1 (true) and 0 (false) are converted to the arithmetic values 1 and 0, respectively. If a SETB symbol is used in the operand field of a SETC instruction, in character relations in the operand fields of AIF and SETB instructions, or in any other statement, the binary values 1 (true) and 0 (false), are converted to the character values '1' and '', respectively. The following example illustrates these rules. It assumes that (L'&TO EQ 4) is true, and (S'&TO EQ ) is false. MACRO &NAME MOVE &TO,&FROM LCLA &A1 LCLB &B1,&B2 LCLC &C1 &B1 SETB (L'&TO EQ 4) Statement 1 &B2 SETB (S'&TO EQ ) Statement 2 &A1 SETA &B1 Statement 3 &C1 SETC '&B2' Statement 4 ST 2,SAVEAREA L 2,&FROM&A1 ST 2,&TO&C1 L 2,SAVEAREA MEND ------------------------------------------------------------------- HERE MOVE FIELDA,FIELDB ------------------------------------------------------------------- +HERE ST 2,SAVEAREA + L 2,FIELDB1 + ST 2,FIELDA + L 2,SAVEAREA Because the operand field of statement 1 is true, &B1 is assigned the binary value 1. Therefore, the arithmetic value +1 is substituted for &B1 in statement 3. 368 HLASM V1R5 Language Reference

SETC Instruction Because the operand field of statement 2 is false, &B2 is assigned the binary value . Therefore, the character value is substituted for &B2 in statement 4. SETC Instruction The SETC instruction assigns a character value to a SETC symbol. You can assign whole character strings, or concatenate several smaller strings together. The assembler assigns the composite string to your SETC symbol. You can also assign parts of a character string to a SETC symbol by using the substring notation; see “Substring Notation” on page 371. You can change the character value assigned to a SETC symbol. This lets you use the same SETC symbol with different values for character comparisons in several places, or for substituting different values into the same model statement. ►►──variable_symbol──SETC──character_value─────────────────────────►◄ variable symbol is a variable symbol. A global variable symbol in the name field must have been previously declared as a SETC symbol in a GBLC instruction. Local SETC symbols need not be declared in a LCLC instruction. The assembler considers any undeclared variable symbol found in the name field of a SETC instruction as a local SET symbol. The variable symbol is assigned a type attribute value of U. character_value is a character value that may be specified by one of the following: An operation code attribute reference A type attribute reference A character expression The assembler assigns the character string value represented in the operand field to the SETC symbol in the name field. The string length must be in the range 0 | (null character string) through 1024 characters. When a SETA or SETB symbol is specified in a character expression, the unsigned decimal value of the symbol (with leading zeros removed) is the character value given to the symbol. A duplication factor can precede a character expression or substring notation. The duplication factor can be any non-negative arithmetic expression allowed in the operand of a SETA instruction. For example: &C1 SETC (3)'ABC' assigns the value 'ABCABCABC' to &C1. A zero duplication factor results in a null (zero-length) string. Chapter 9. How to Write Conditional Assembly Instructions 369

SETB Instruction<br />

The two comparands in a character relation are compared, character by<br />

character, according to binary (EBCDIC) representation of the characters. If<br />

two comparands in a relation have character values of unequal length, the<br />

assembler always takes the shorter character value to be less.<br />

3. The assembler carries out logical operations from left to right. However,<br />

a. It carries out logical NOTs before logical ANDs, ORs and XORs<br />

b. It carries out logical ANDs before logical ORs and XORs<br />

c. It carries out logical ORs before logical XORs<br />

4. In parenthesized logical expressions, the assembler evaluates the innermost<br />

expressions first, and then considers them as logical terms in the next outer<br />

level of expressions. It continues this process until it evaluates the outermost<br />

expression.<br />

Using SETB Symbols: The logical value assigned to a SETB symbol is used for<br />

the SETB symbol appearing in the operand field of an AIF instruction or another<br />

SETB instruction.<br />

If a SETB symbol is used in the operand field of a SETA instruction, or in arithmetic<br />

relations in the operand fields of AIF and SETB instructions, the binary values 1<br />

(true) and 0 (false) are converted to the arithmetic values 1 and 0, respectively.<br />

If a SETB symbol is used in the operand field of a SETC instruction, in character<br />

relations in the operand fields of AIF and SETB instructions, or in any other<br />

statement, the binary values 1 (true) and 0 (false), are converted to the character<br />

values '1' and '', respectively.<br />

The following example illustrates these rules. It assumes that (L'&TO EQ 4) is true,<br />

and (S'&TO EQ ) is false.<br />

MACRO<br />

&NAME MOVE &TO,&FROM<br />

LCLA<br />

&A1<br />

LCLB<br />

&B1,&B2<br />

LCLC<br />

&C1<br />

&B1 SETB (L'&TO EQ 4) Statement 1<br />

&B2 SETB (S'&TO EQ ) Statement 2<br />

&A1 SETA &B1 Statement 3<br />

&C1 SETC '&B2' Statement 4<br />

ST<br />

2,SAVEAREA<br />

L<br />

2,&FROM&A1<br />

ST<br />

2,&TO&C1<br />

L<br />

2,SAVEAREA<br />

MEND<br />

-------------------------------------------------------------------<br />

HERE MOVE FIELDA,FIELDB<br />

-------------------------------------------------------------------<br />

+HERE ST<br />

2,SAVEAREA<br />

+ L 2,FIELDB1<br />

+ ST 2,FIELDA<br />

+ L 2,SAVEAREA<br />

Because the operand field of statement 1 is true, &B1 is assigned the binary value<br />

1. Therefore, the arithmetic value +1 is substituted for &B1 in statement 3.<br />

368 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!