 |
» |
|
|
 |
The expression evaluator is a system procedure used by the
user interface to accept a string, number, or Boolean expression,
evaluate it, and return the result. This procedure is used by the CALC, SETVAR, IF, ELSEIF, and WHILE commands and within a ![ ].. The expression evaluator provides the following: consistent evaluation of expressions compatibility with MPE V/E job control word evaluation
The expression evaluator uses algebraic notation and supports
the functions defined in Table B-1 “Expression Evaluator Functions”. The references
that appear in this table in parentheses, for example (8), are defined
following the table. See HELP for description of new functions and examples. E.g. HELP FSYNTAX 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 (9) | 2^3 | 8 | | either " or ' | string identifier | either "abc' or "abc' | abc | | () | parentheses | (3 + 4) * 2 | 14 | | < | less than (1) | 5 < 6 | TRUE | | <= | less than or equal (1) | "abc' <= "abc' | TRUE | | > | greater than (1) | "xyz' > "abc' | TRUE | | >= | greater than or equal (1) | "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 alphabetic | alpha('abcd') alpha('ab3d ef') | | | ALPHANUM(string) | check if a string is only alphabetics
and digits | alphanum('abCd') alphanum('45abd') alphanum('3d
ef') | | | AND | logical and | 7=7 and 5=5 | TRUE | | ANYPARM | | | | | BAND | bitwise and | 7 band 13 | 5 | | BASENAME (string) | returns the filename component | CALC basename ('a.b.c') CALC
basename ('/a/b/c') CALC basename ('./a/b') CALC
basename ("./a.sl",".sl") CALC
basename ('/') CALC basename ("*feq") CALC
basename ('$null') CALC basename ('abc.g','c') CALC
basename (/usr/lib/liby.a','.a') CALC
basename ('/usr/lib/liby.a','liby.a' | A
c
b
a /
*FEQ
$NULL
AB
liby
liby.a | | BNOT | bitwise not | bnot 5 | -6 | | BOR | bitwise or | 5 bor 2 | 7 | | BOUND(varname) | variable definition test (2) | bound(HPPATH) | TRUE | | BXOR | bitwise exclusive or | 7 bxor 5 | 2 | | CHR(integer) | ASCII value (integer) ===> character | chr(65) | A | | CSL | circular shift left (3) | -2 csl 2 | -5 | | CSR | circular shift right (3) | -7 csr 1 | -4 | | DECIMAL(string) | returns a string value of an integer | CALC decimal (255) CALC len(decimal($ff)) setvar
i 0 while setvar(i,i+1) < 10 and finfo("FILE"+DECIMAL(I), 'exists')
do ... | 255
3, $3, %3 | DELIMPOS (str,[,delims] [,nth][,start]) | returns index in str of the nth delimiter beginning at start; default delims are a space, a comma, a semicolon, an equals sign,
left and right parentheses, left and right brackets, single quote,
double quote, and Tab; default nth is 1; default start is 1 | DELIMPOS('file a=bb, old;rec=40,,f,ascii') | 5 | | DIRNAME()(string) | returns dirctory components of a filename | | | | DWNS(string) | shift string to lowercase (7) | dwns('aBC&#dE') | abc&#de | EDIT(string,editstr [,start]) | performs full REDO-like editing of a string | EDIT(`abcdefg','>dd') EDIT('ab cd;g', 'dwd') | | FINFO(filename, option) | file information (6) | FINFO('x.pub',0) | TRUE | | FQUALIFY(string) | returns a fully qualified filename | CALC fqualify('a')
CALC
fqualify('a.b') CALC fqualify('a.b.c') CALC
fqualify('./a') CALC fqualify('./A')
CALC
fqualify('/a/b/c') CALC fqualify('*a') CALC
fqualify('$null') CALC dirname (fqualify('./a')) | A.GROUP.ACCOUNT # when the CWD is your logon group
or /CWD/A #when the CWD is s a directory A.B.ACCOUNT A.B.C /ACCOUNT/GROUP/a A.GROUP.ACCOUNT
# when the CWD is your logon group or /CWD #when the CWD
is a directory /a/b/c *A $NULL /ACCOUNT
GROUP # when the CWD is your logon group or CWD # when
the CWD is a directory | | FSYNTAX()(string) | returns the syntax of the passed filename argument | fsyntax('a.b.c') fsyntax('/a/b/c') fsyntax('./ab@/c') fsyntax($null') fsyntax('a.b.c.d') | MPE POSIX POSIX;WILD MPE;$FILE
MPE ERROR=426 | | HEX(integer) | convert to hexadecimal string | hex(329) | $149 | INPUT([prompt] [,wait]) | accept user input (10) | input('Enter choice:',20) | Enter choice: YReturn "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 [,trimstr]) | trim left end of string (11) | 'X'+ltrim(' abc') "X"+ltrim('...abc',
'.') | | | MAX(num1[,num2...]) | find largest of several integers | max(5,4-3,70,0) | 70 | | MIN(num1[,num2...]) | find smallest of several integers | min(5,4,-3,70,0) | -3 | | MOD | modulo (4) | 25 mod 2 | 1 | | NOT | logical not | not(2>1) | FALSE | | NUMERIC (string) | check if a string is all digits | numeric('12345') numeric('$a234ef') | | | OCTAL(integer) | convert to octal string | octal(329) | %511 | | ODD(integer) | determine if integer is odd | | | | OR | logical or | 5=5 or 2=3 | TRUE | | ORD(string) | ordinal (8) | ord('AbcD') | 65 | | POS(find str,source str[,n]) | find nth occurrence of find str in source str; positive value for n begins search at left; negative value for n begins search at right) (12) | pos('ab','cgabd') pos('.','file.grp.acct',2) pos('.','file.grp.acct',-1) | | | PMATCH(pattern,str [,start]) | searches for pattern in a given string (str) starting at start; pattern may contain wildcards; default start is 1 | PMATCH('f@','fread') PMATCH('abc','abcd') | | | REPL(str,oldstr,newstr [,cnt][,start]) | in a given string (str), replaces cnt occurrences of oldstr with newstr, beginning at start; if cnt is positive, replacement begins at the left end of str; if negative, replacement begins at the right end
of str; default start is 1; default cnt is zero (meaning all occurences) | REPL('aaabcaab','aa','X') REPL('aaabcaab','ab','',-1) | | | RHT(string, # chars) | right string extraction | rht("abc',2) | bc | | RPT(string,count) | repeat a string (-count reverses string) | rpt('aBc',3) rpt('aBc',-3) | | RTRIM(string [,trimstr]) | trim right end of string (11) | rtrim('abc ')+'X' rtrim('abc...','.')+"X" | | SETVAR (varname,expr) | return result of expr and set varname to result (13) | setvar(myvar,2*3+5) | sets variable myvar to 11 and returns 11 | | STR(string,start pos, # chars) | general string extraction | str('abcde',2,3) | bcd | | TYPEOF(expression) | type of variable or expression
(5) | typeof(HPPATH) | 2 (string) | | UPS(string) | shift string to uppercase (7) | ups('aBc5d') | ABC5D | | WORD(string,[,delims] [,nth][,end_var][,start]) | performs general word extraction; default delims are a space, a comma, a semicolon, an equals sign,
left and right parentheses, left and right brackets, single quote,
double quote, and Tab; default nth is 1; the default end_var is no variable; the default start is 1 | WORD('file a=bb,old; rec=40,,f,ascii') WORD('file
a=bb,old; rec=40,,f,ascii',,-4,j) | | | XOR | logical exclusive or | 7=7 xor 5=5 | TRUE | | XWORDstring) | returns a string less 'word' | xword('file a=bb, old; rec=40, ,f,
ascii') xword('file a=bb, old; rec=40,
,f, ascii' , ,2) xword('file a=bb, old; rec=40,
,f, ascii' , " ; , " , , j, 8) xword('file
a=bb, old; rec=40, ,f, ascii' , , -4, j) | 'a=bb,old;rec=40, , f, ascii'
'file
bb, old; rec=40 , , f, ascii'
'file
a=old; rec=40 , ,f , ascii' and J=10
'file
a=bb, old;rec=, f, ascii ' and J=18 |
|