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

SETC Instruction Notes: 1. The assembler evaluates the represented character string (in particular, the substring, see “Substring Notation” on page 371) before applying the duplication factor. The resulting character string is then assigned to the SETC symbol in the name field. For example: &C2 SETC 'ABC'.(3)'ABCDEF'(4,3) assigns the value 'ABCDEFDEFDEF' to &C2. 2. If the character string contains double-byte data, then redundant SI/SO pairs are not removed on duplication. For example: &C3 SETC (3)'' assigns the value '' to &C3. 3. To duplicate double-byte data, without including redundant SI/SO pairs, use the substring notation. For example: &C4 SETC (3)''(2,4) assigns the value '.A.B.A.B.A.B' to &C4. 4. To duplicate the arithmetic value of a previously defined ordinary symbol with an absolute value, first assign the arithmetic value to a SETA symbol. For example: A EQU 123 &A1 SETA A &C5 SETC (3)'&A1' assigns the value '123123123' to &C5. Subscripted SETC Symbols The SETC symbol (see ▌1▐ in Figure 102 on page 371) in the name field can be subscripted, but only if the same SETC symbol has been previously declared (see ▌2▐ in Figure 102) in a GBLC or an LCLC instruction with an allowable dimension. The assembler assigns the character value represented in the operand field to the position in the declared array (see ▌3▐ in Figure 102) given by the value of the subscript. The subscript expression must not be 0 or have a negative value. 370 HLASM V1R5 Language Reference

Substring Notation LCLC &C1,&C2 LCLC &SUBSCRC(2) . ▲ ┌─── ▌1▐ . └─── ▌2▐ ▼ . &SUBSCRC(1) SETC 'ABCDE' . │ . │ . │ ────────────────────────┼────────────────────────────────────────────── ▌3▐─────┐ &SUBSCRC Array: │ ▼ ┌─────┬─────┬─────┬────/ /────┬─────┬─────┬─────┬────/ /────┬─────┐ │ │ │ │ │ABCDE│ │ │ │ │ └─────┴─────┴─────┴────/ /────┴─────┴─────┴─────┴────/ /────┴─────┘ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ ▲ 1 2 3 4 1 11 12 13 2 Figure 102. Subscripted SETC Symbols Character (SETC) Expressions The main purpose of a character expression is to assign a character value to a SETC symbol. You can then use the SETC symbol to substitute the character string into a model statement. You can also use a character expression as a value for comparison in condition tests and logical expressions. Also, a character expression provides the string from which characters can be selected by the substring notation. Substitution of one or more character values into a character expression lets you use the character expression wherever you need to vary values for substitution or to control loops. A character string consists of any combination of characters enclosed in single quotation marks. Variable symbols are allowed. The assembler substitutes the representation of their values as character strings into the character expression | before evaluating the expression. Up to 1024 characters are allowed in a character expression. An attribute reference must be the only term in a character expression. Substring Notation: The substring notation lets you refer to one or more characters within a character string. You can, therefore, either select characters from the string and use them for substitution or testing, or scan through a complete string, inspecting each character. By concatenating substrings with other substrings or character strings, you can rearrange and build your own strings. The substring notation can be used only in conditional assembly instructions. Figure 103 shows how to use the substring notation. Chapter 9. How to Write Conditional Assembly Instructions 371

SETC Instruction<br />

Notes:<br />

1. The assembler evaluates the represented character string (in particular, the<br />

substring, see “Substring Notation” on page 371) before applying the<br />

duplication factor. The resulting character string is then assigned to the SETC<br />

symbol in the name field. For example:<br />

&C2 SETC 'ABC'.(3)'ABCDEF'(4,3)<br />

assigns the value 'ABCDEFDEFDEF' to &C2.<br />

2. If the character string contains double-byte data, then redundant SI/SO pairs<br />

are not removed on duplication. For example:<br />

&C3 SETC (3)''<br />

assigns the value '' to &C3.<br />

3. To duplicate double-byte data, without including redundant SI/SO pairs, use the<br />

substring notation. For example:<br />

&C4 SETC (3)''(2,4)<br />

assigns the value '.A.B.A.B.A.B' to &C4.<br />

4. To duplicate the arithmetic value of a previously defined ordinary symbol with<br />

an absolute value, first assign the arithmetic value to a SETA symbol. For<br />

example:<br />

A EQU 123<br />

&A1 SETA A<br />

&C5 SETC (3)'&A1'<br />

assigns the value '123123123' to &C5.<br />

Subscripted SETC Symbols<br />

The SETC symbol (see ▌1▐ in Figure 102 on page 371) in the name field can be<br />

subscripted, but only if the same SETC symbol has been previously declared (see<br />

▌2▐ in Figure 102) in a GBLC or an LCLC instruction with an allowable dimension.<br />

The assembler assigns the character value represented in the operand field to the<br />

position in the declared array (see ▌3▐ in Figure 102) given by the value of the<br />

subscript. The subscript expression must not be 0 or have a negative value.<br />

370 <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!