HLASM Language Reference
HLASM Language Reference HLASM Language Reference
SETA Instruction | The result of C2A is the same as would be obtained from | &value SETA C'charstring' | except that C2A gives a zero result for null strings, and does not pair | apostrophes or ampersands before conversion. | Example | C2A('') has value | C2A('+') has value 78 | C2A('1') has value 241 | C2A('') has value -252645136 | D2A | Format: Function-invocation | Operands: Character | Output: D2A('decstring') converts a character string argument containing an | optional leading plus or minus sign followed by decimal digits to an arithmetic | value. Error conditions are detected if | the argument contains invalid characters | no digits are present following a sign | the argument length exceeds 11 characters | the resulting value is too large | the argument string is null. | The result of the D2A function is the same as | &value SETA decstring | except that SETA does not allow leading plus or minus signs. | Examples | D2A('') indicates an error condition | D2A('') has value | D2A('1') has value 1 | D2A('+1') has value 1 | D2A('-5') has value -5 | DCLEN | Format: Function-invocation | Operands: Character | Output: DCLEN('cexpr') returns the length of its argument string after pairs of | apostrophes and ampersands have been internally replaced by single | occurrences. No change is made to the argument. Such pairing occurs only | once; that is, three successive occurrences of an apostrophe or ampersand | will result in two occurrences, not one. | Examples | DCLEN('') has value (null string) | DCLEN('''') has value 1 (argument is a single apostrophe) | DCLEN('''''') has value 2 (argument is two apostrophes) | DCLEN('&&') has value 1 (argument is two ampersands) | DCLEN('a''''b') has value 3 (DCVAL string would be "a'b") | DCLEN('a''''b&&c') has value 5 (DCVAL string would be "a'b&c") | DCLEN('&&&''''''') has value 4 (DCVAL string would be "&&''") | Note: DCLEN is similar to DCVAL, except that DCLEN returns only the length | of the result, not the paired string. 354 HLASM V1R5 Language Reference
SETA Instruction FIND INDEX Format: Logical-expression, function-invocation Operands: Character Output: (string1 FIND string2) or FIND(string1,string2) finds the first match of any character from operand2 within operand1. The value returned by FIND indicates the position where the match occurs. FIND returns 0 if no match occurs or if either operand is a null string. Examples After the following statements &VAR contains the arithmetic value 3. Name Operation Operand &OP1 SETC 'abcdef' &OP2 SETC 'cde' &VAR SETA ('&OP1' FIND '&OP2') In the above example the character c in &OP2 is the first character found in &OP1. Consider the following example where the character c, in &OP1, has been replaced with the character g. Name Operation Operand &OP1 SETC 'abcdef' &OP2 SETC 'gde' &VAR SETA ('&OP1' FIND '&OP2') &VAR contains the arithmetic value 4. The character d in &OP2 is the first character found in &OP1. In the following example, the ordering of the characters in the second operand is changed to egd. Name Operation Operand &OP1 SETC 'abcdef' &OP2 SETC 'egd' &VAR SETA FIND('&OP1','&OP2') &VAR still contains the arithmetic value 4. Because FIND is looking for a single character from the character string, the order of the characters in the second operand string is irrelevant. Format: Logical-expression, function-invocation Operands: Character Output: INDEX('cexpr1','cexpr2') or ('cexpr1' INDEX 'cexpr2') locates the first occurrence of the second argument within the first argument, and returns the position of the match. A zero value is returned if: Either argument is null No match is found The second argument is longer than the first Examples INDEX('ABC','B') has value 2 INDEX('ABC','D') has value Chapter 9. How to Write Conditional Assembly Instructions 355
- 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
- Page 372 and 373: SETA Instruction | Figure 99 (Page
- 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:
- Page 388 and 389: SETB Instruction The two comparands
- Page 390 and 391: SETC Instruction Notes: 1. The asse
- Page 392 and 393: Figure 103. Substring Notation in C
- Page 394 and 395: Loc Object Code Addr1 Addr2 Stmt So
- Page 396 and 397: | B2C('111111') has value '3' | B2C
- Page 398 and 399: | Output: D2B('decstring') converts
- Page 400 and 401: SIGNED Format: Logical-expression,
- Page 402 and 403: | X2D('') has value '+' | X2D('91')
- Page 404 and 405: Concatenation of strings containing
- Page 406 and 407: MACRO &NAME MOVE &TO,&FROM LCLC &PR
- Page 408 and 409: SETAF Instruction Alternative State
- Page 410 and 411: Branching Branching You can control
- Page 412 and 413: AGO Instruction The extended AIF in
- Page 414 and 415: ACTR Instruction AGOB—Synonym of
- Page 416 and 417: ANOP Instruction statement processe
- Page 418 and 419: MHELP Instruction MHELP B'10000000'
- Page 420 and 421: 400 HLASM V1R5 Language Reference
- Page 422 and 423: Assembler Instructions and Statemen
SETA Instruction<br />
FIND<br />
INDEX<br />
Format: Logical-expression, function-invocation<br />
Operands: Character<br />
Output: (string1 FIND string2) or FIND(string1,string2) finds the first<br />
match of any character from operand2 within operand1. The value returned<br />
by FIND indicates the position where the match occurs. FIND returns 0 if no<br />
match occurs or if either operand is a null string.<br />
Examples<br />
After the following statements &VAR contains the arithmetic value 3.<br />
Name Operation Operand<br />
&OP1 SETC 'abcdef'<br />
&OP2 SETC 'cde'<br />
&VAR SETA ('&OP1' FIND '&OP2')<br />
In the above example the character c in &OP2 is the first character found in<br />
&OP1. Consider the following example where the character c, in &OP1, has<br />
been replaced with the character g.<br />
Name Operation Operand<br />
&OP1 SETC 'abcdef'<br />
&OP2 SETC 'gde'<br />
&VAR SETA ('&OP1' FIND '&OP2')<br />
&VAR contains the arithmetic value 4. The character d in &OP2 is the first<br />
character found in &OP1.<br />
In the following example, the ordering of the characters in the second operand<br />
is changed to egd.<br />
Name Operation Operand<br />
&OP1 SETC 'abcdef'<br />
&OP2 SETC 'egd'<br />
&VAR SETA FIND('&OP1','&OP2')<br />
&VAR still contains the arithmetic value 4. Because FIND is looking for a single<br />
character from the character string, the order of the characters in the second<br />
operand string is irrelevant.<br />
Format: Logical-expression, function-invocation<br />
Operands: Character<br />
Output: INDEX('cexpr1','cexpr2') or ('cexpr1' INDEX 'cexpr2') locates<br />
the first occurrence of the second argument within the first argument, and<br />
returns the position of the match. A zero value is returned if:<br />
Either argument is null<br />
No match is found<br />
The second argument is longer than the first<br />
Examples<br />
INDEX('ABC','B') has value 2<br />
INDEX('ABC','D') has value <br />
Chapter 9. How to Write Conditional Assembly Instructions 355