Ap B. Evaluator Functions [ Command Interpreter Access and Variables Programmer's Guide ] MPE/iX 5.0 Documentation
Command Interpreter Access and Variables Programmer's Guide
Appendix B Evaluator Functions
The following table identifies most of the expression evaluator
functions. For a list of the latest evaluator functions, refer to the
MPE/iX Commands Reference Manual (32650-90003).
Table B-1. Expression Evaluator Functions
-------------------------------------------------------------------------------------------------
| | | | |
| Symbol | Function | Example | Result |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| +(numeric) | addition | 4 + 5 | 9 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| +(string) | concatenate | "abc" + "de" | abcde |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| -(numeric) | subtraction | 12 - 6 | 6 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| -(string) | deletion of first occurrence | "abc" - "b" | ac |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| * | multiplication | 4 * 5 | 20 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| / | integer division | 79/ 10 | 7 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ^ | exponentiation (0^0 yields 1) | 2^3 | 8 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| either " or ' | string identifier | either "abc" or 'abc' | abc |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| () | parentheses | (3 + 4) * 2 | 14 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| < | less than (Strings are | 5 < 6 | TRUE |
| | compared character by | 'abcc' < 'abdc' | TRUE |
| | character, until an inequality | 'abcd' &> 'abc' | TRUE |
| | exists.) | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| <= | less than or equal | "abc" <= "abc" | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| > | greater than | "xyz" > "abc" | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| >= | greater than or equal | "abc" >= "abc" | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| <> | not equal | 5 <> 6 | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| = | equal | "xyz"= "xyz" | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ABS(integer) | absolute value | ABS(-4) | 4 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ALPHA(string) | check if a string is | ALPHA('abcd') | TRUE |
| | alphabetic | ALPHA('ab3d ef') | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ALPHANUM(string) | check if a string is only | ALPHANUM('abCd') | TRUE |
| | alphabetics and digits | ALPHANUM('45abd') | TRUE |
| | | ALPHANUM('3d ef') | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| AND | logical and | 7=7 AND 5=5 | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
Table B-1. Expression Evaluator Functions (cont.)
-------------------------------------------------------------------------------------------------
| | | | |
| Symbol | Function | Example | Result |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| BAND | bitwise and | 7 BAND 13 | 5 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| BNOT | bitwise not | BNOT 5 | -6 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| BOR | bitwise or | 5 BOR 2 | 7 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| BOUND(varname) | variable definition test | BOUND(HPPATH) | TRUE |
| | (Returns TRUE if varname has | | |
| | been defined.) | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| BXOR | bitwise exclusive or | 7 BXOR 5 | 2 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| CHR(integer) | ASCII value (integer) ===> | CHR(65) | A |
| | character | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| CSL | circular shift left | -2 CSL 2 | -5 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| CSR | circular shift right | -7 CSR 1 | -4 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| DWNS(string) | shift string to lowercase | DWNS('aBC&#dE') | abc&#de |
| | (Operates on ASCII characters | | |
| | in ranges of 'a' through 'z' | | |
| | and 'A' through 'Z' only.) | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| FINFO(filename,option)| file information | FINFO('x.pub',0) | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| HEX(integer) | convert to hexadecimal string | HEX(329) | $149 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| INPUT([prompt][,wait])| accept user input | INPUT('Enter | Enter |
| | | choice:',20) | choice: Y |
| | | | Return "Y" |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| LEN(string) | string length | LEN("abc") | 3 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| LFT(string, # chars) | left string extraction | LFT('abc',2) | ab |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| LSL | logical shift left | 7 LSL 1 | 14 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| LSR | logical shift right | -7 LSR 1 | 2,147,483,644|
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| LTRIM(string | trim left end of string | 'X'+LTRIM(' abc') | Xabc |
| [,trimstr]) | | "X"+LTRIM('...abc', | Xabc |
| | | '.') | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| MAX(num1[,num2...]) | find largest of several | MAX(5,4-3,70,0) | 70 |
| | integers | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| MIN(num1[,num2...]) | find smallest of several | MIN(5,4,-3,70,0) | -3 |
| | integers | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| MOD | modulo | 25 MOD 2 | 1 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| NOT | logical not | NOT(2>1) | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| NUMERIC(string) | check is a string is all | NUMERIC('12345') | TRUE |
| | digits | NUMERIC('$a234ef') | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| OCTAL(integer) | convert to octal string | OCTAL(329) | %511 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ODD(integer) | determine if integer is odd | ODD(233) | TRUE |
| | | ODD(-2) | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| OR | logical or | 5=5 OR 2=3 | TRUE |
| | | | |
-------------------------------------------------------------------------------------------------
Table B-1. Expression Evaluator Functions (cont.)
-------------------------------------------------------------------------------------------------
| | | | |
| Symbol | Function | Example | Result |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| ORD(string) | ordinal | ORD('AbcD') | 65 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| POS(find str,source | find Nth occurrence of find | POS('ab','cgabd') | 3 |
| str[,n]) | str in source str (-N searches | POS('.','file.grp. | 9 |
| | from right) | acct',2) | 9 |
| | | POS('.','file.grp. | |
| | | acct',-1) | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| RHT(string, # chars) | right string extraction | RHT("abc",2) | bc |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| RPT(string,count) | repeat a string (-count | RPT('aBc',3) | aBcaBcaBc |
| | reverses string) | RPT('aBc',-3) | cBacBacBa |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| RTRIM(string | trim right end of string | RTRIM('abc ')+'X' | abcX |
| [,trimstr]) | | RTRIM('abc...','.') | abc X |
| | | +"X" | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| SETVAR(varname,expr) | return result of expr and set | SETVAR(myvar,2*3+5) | sets |
| | varname to result | | variable |
| | | | myvar to 11 |
| | | | and returns |
| | | | 11 |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| STR(string,start pos, | general string extraction | STR('abcde',2,3) | bcd |
| # chars) | | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| TYPEOF(expression) | type of variable or expression | TYPEOF(HPPATH) | 2 (string) |
| | (0 = invalid, 1 = integer, 2 = | | |
| | string, 3 = Boolean value) | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| UPS(string) | shift string to uppercase | UPS('aBc5d') | ABC5D |
| | (Operates on ASCII characters | | |
| | in range of 'a' through 'z' | | |
| | and 'A' through 'Z'.) | | |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| XOR | logical exclusive or | 7=7 XOR 5=5 | FALSE |
| | | | |
-------------------------------------------------------------------------------------------------
MPE/iX 5.0 Documentation