HPlogo MPE/iX Commands Reference Manual > Appendix B Expression Evaluator Functions

References

MPE documents

Complete PDF
Table of Contents
Index

The following references apply to the numbers that appear in parentheses in table B-1.
  1. Special rules apply when you use the comparison operators with strings. The strings are compared, character by character, until an inequality is found. This becomes the inequality of the strings. For example: 'ba' > 'abcd' and 'abcc' < 'abdc'. If string1 is longer than string2, and if string1 and string2 are equal up to the length of the string2, then string1 > string2 evaluates as TRUE.

  2. The BOUND(varname) function returns the value TRUE if varname has been defined (assigned a value) and FALSE if it has not been defined. The BOUND function is defined as follows:

    • BOUND (name of a defined variable) = TRUE

    • BOUND (name of an undefined variable) = FALSE

    • BOUND (numeric value of expression) = TRUE

    • BOUND (string value of expressions) = TRUE

    • BOUND (Boolean value of expression) = TRUE

    For example
    
       setvar a 6
       calc bound(a)           TRUE
       deletevar a
       calc bound(A)           FALSE
       calc bound(1+2)         TRUE
       calc bound('a'+'b')     TRUE
       calc bound(5<4)         TRUE
    
    
    In BOUND (expression), if expression is not a valid expression, an error message is displayed

  3. The circular shift operators, CSL and CSR, shift the specified number of bits in a 32-bit word in the specified direction. When 1 or 0 is shifted off one end, it comes back onto the other end. The logical shift operators, LSL and LSR, perform the same shifting as the circular shift operators, but when 1 or 0 is shifted off one end, a 0 comes back at the other end.

  4. The modulo operation functions as it is defined by Donald E. Knuth, The Art of Computer Programming, Addison-Wesley Publishing Co., Reading, MA; Second ed., 1973; Volume I, p. 38.

  5. The TYPEOF(expression) returns one of the following integer values:

    • 0 if expression is invalid.

    • 1 if expression evaluates to an integer.

    • 2 if expression evaluates to a string.

    • 3 if expression evaluates to a Boolean value.

  6. The FINFO function returns a string, Boolean, or an integer value. The result depends upon the option specified.

    The first parameter, filename, is a string, the name of the file for which you want the information. This must be a fully or partly qualified file name, or a string expression that yields such a file name.

    This parameter can also be a string that specifies a file equation by backreference, for example, FINFO("*XIN', 1), which references the equation FILE XIN=....

    The second parameter, option, may be an integer (or integer expression) corresponding to the FLABELINFO intrinsic item numbers. Options 0 and 1 and the negative options are exceptions. The negative options provide the same information as their positive counterparts, except the format of the data is different.

    The option parameter may also be a string mnenomic which corresponds to an integer value. The string value is often easier to remember than the integer. Table B-2, which follows, summarizes all of the FINFO options.

    Users with system manager (SM) capabilities may use options 4 and 33 on any file within the system. Users with account manager (AM) capabilities may use those options only on files within their account.

  7. The DWNS() and UPS() functions operate only on ASCII characters in the ranges "a" through "z" and "A" through "Z".

  8. The ORD() and CHR() functions operate only on ASCII characters in the range 0 through 255.

  9. 0^0 (zero to the zero power) yields 1.

  10. The INPUT() function is different from other evaluator functions in that the execution of the command in which the function appears stops while input is taken from the user. The syntax is as follows:

    
      INPUT([prompt][,wait])
    
    
    INPUT reads from $STDIN. If a prompt is specified, it is written to $STDLIST before reading. If a wait is specified, the read is a timed read. The duration of the timed read is the lesser of wait seconds or the value of the HPTIMEOUT variable in minutes. The result of the read is returned as the string value of the function. If the user gave no input, but just pressed Return, the empty string is returned. If the timeout specified in the function itself (as opposed to the HPTIMEOUT timeout) expires, the empty string is returned. If the HPTIMEOUT timeout expires, the session is terminated.


    NOTE: This function should be used carefully since it interrupts execution of a command. It is not executed if it is skipped as a result of evaluation of a previous clause of a Boolean expression. This is the right side of an AND where the left is FALSE or the right side of an OR where the left is TRUE. For example:
    
      IF "!filename" = " " AND SETVAR (filename,input &
      ('Enter filename:'))<>" " THEN
      comment If filename is not empty, the left
      comment side of the AND is FALSE and so
      comment the right side is not executed.  This
      comment means no INPUT() will be performed.
    
    

    For LTRIM and RTRIM if trimstr is not given, then a space is used as the default.

    POS (findstr,sourcestr[,N]). If N is specified, the Nth occurrence of findstr is searched for in sourcestr. If N is negative, the ABS(N)th occurrence of findstr is searched for in sourcestr from the right. A value of zero for N results in a zero being returned. This is the same value which is returned if the requested occurrence of findstr is not found in sourcestr. For example:

    
      POS('.','FILE.GRP.ACCT') WILL RETURN 5
      POS('.','FILE.GRP.ACCT',-1) WILL RETURN 9
    
    
    The SETVAR() function is different from other evaluator functions in that it is the first function that modifies its environment. The syntax is as follows:
    
      SETVAR (varname, expression)
    
    
    The expression is evaluated. If it evaluates with no errors, the value is returned and the variable with the name given as the first parameter is set to that value. Normal rules on setting variables apply: if it does not exist, it is created; if it does exist, its type is set to the type of the result of expression. Please refer to the SETVAR command for additional information. The Table B-2 "FINFO Specifications" shows the FINFO Specifications


NOTE: The SETVAR() function is not executed in a partial evaluation skip state. See the INPUT() function above for an example.

Table B-2 FINFO Specifications

Number Alias Data Type Item Description
0 EXIST BooleanExistence of file
1 FILENAME ONLY
FNAME
FULL FILENAME
FULLFNAME
FULLY QUALIFIED FILENAME
StringFile name
2 GROUP
GROUPNAME
StringGroup name
3 ACCOUNT
ACCT
ACCOUNTNAME
StringAccount name
4 CREATOR StringFile creator name
5 FMTSECURITY
FORMATTED SECURITY MATRIX
StringSecurity matrix for access
-5 SECURITY MATRIX
INTSECURITY
IntegerSecurity matrix for access
6 CREATED
CREATION DATE
FMTCREATED
StringFile creation date
-6 CREATION DATE INTEGER
INTCREATED
IntegerFile creation date
7 ACCESSED
FMTACCESSED
LAST ACCESS DATE
StringLast access date
-7 LAST ACCESS DATE INTEGER
INTACCESSED
IntegerLast access date
8 MODIFIED
LAST MOD DATE
FMTMODDATE
StringLast modification date
-8 LAST MOD DATE INTEGER
INTMODDATE
IntegerLast modification date
9 FILE CODE MNEMONIC
FMTFCODE
StringFile code of disk file
-9 FCODE
INTFCODE
FILE CODE
IntegerFile code of disk file
10 USER LABELS WRITTEN IntegerNumber of user labels written
11 USER LABELS AVAIL IntegerNumber of user labels available
12 FILE LIMIT
LIMIT
IntegerTotal number of logical records possible in the file
13 FORMATTED FOPTIONS
FMTFOPT
StringFile options
-13FOPTIONS
INTFOPT
IntegerFile options
14 RECORD SIZE
RECSIZE
IntegerRecord size
15 BLOCK SIZE
BLKSIZE
IntegerBlock size
16 MAX EXTENTS
MAXEXT
IntegerMaximum number of extents
17 LAST EXTENT SIZE
LASTEXTSIZE
IntegerLast extent size
18 EXTENT SIZE
EXTSIZE
IntegerExtent size
19 END OF FILE
EOF
IntegerNumber of logical records in file
20 ALLOC TIME
FMTALLOCTIME
StringFile allocation time
-20ALLOC TIME INTEGER
INTALLOCTIME
IntegerFile allocation time
21 ALLOC DATE
FMTALLOCDATE
ALLOCATED
StringFile allocation date
-21ALLOC DATE INTEGER
INTALLOCDATE
IntegerFile allocation date
22 NUM OPEN CLOSE RECS IntegerNumber of open/close records
23 DEVICE NAME
DEV NAME
StringDevice name (8 bytes
24 FMTMODTIME
LAST MOD TIME
StringLast modification time
-24INTMODTIME
LAST MOD TIME
IntegerLast modification time
25 FIRST USER LABEL StringFirst user label (user label 0)
27UNIQUE FILE ID
UFID
StringUnique file identifier (UFID)
28BYTE FILE SIZE
BYTEFILESIZE
IntegerTotal number of bytes allowed in file
29BYTE DATA OFFSET
DATASTART
IntegerStart of file offset
30BYTE RECORD SIZE
BYTERECSIZE
IntegerRecord size (indicates bytes)
31BYTE BLOCK SIZE
BYTEBLKSIZE
IntegerBlock size (indicates bytes)
32BYTE EXTENT SIZE
BYTEEXTSIZE
IntegerExtent size (indicates bytes)
33LOCKWORD StringFile lockword
34VOLUME RESTRICTION
VOLRESTR
StringVolume restriction
35VOLUME SET NAME StringVolume set names
36LOG SET ID StringTransaction management log set id
37LDEV
LOGICAL DEVICE NUMBER
IntegerLogical device number
38POSIX FULL FILE NAME
POSIXFULLFNAME
StringTerminated HFS-syntax system absolute pathname
39NUM HARD LINKS
NUMHARDLINKS
IntegerThe current number of hard links to the file
40ACCESS TIME
FMTACCESSTIME
LAST ACCESS TIME
StringTime of last file access (clock format)
-40LAST ACCESS TIME INTEGER
INTACCESSTIME
IntegerTime of last file access (clock format)
41STATUS CHANGE TIME
FMTSTATUSCHANGETIME
StringTime of last file status change (clock format)
-41INTSTATUSCHANGETIME
CHANGE TIME INTEGER
IntegerChange Time Integer
42STATUS CHANGE DATE
FMTSTATUSCHANGEDATE
StringDate of the last file status change (calendar format)
-42CHANGE DATE INTEGER
INTSTATUSCHANGEDATE
IntegerDate of the last file status change (calendar format)
43 FILE OWNER NAME
OWNER
StringFile owner
44 FILE OWNER ID
UID
IntegerFile owner identifier
45 FILE GROUP NAME
FILEGROUP
StringFile group
46 FILE GROUP ID
GID
IntegerFile group identifier
47 FILE TYPE
FILETYPE
StringFile type
-47FILE TYPE INTEGER
INTFILETYPE
IntegerFile type
48 RECORD TYPE
RECTYPE
IntegerRecord type
49 BYTE FILE SIZE
BYTEFILESIZE
IntegerCurrent file size (in bytes)
50 KSAM VERSION
KSAMVERS
IntegerKSAM XL file version
51 KSAM LABEL
KSAMPARAM
StringKSAM XL parameters
52 DEVICE TYPE
DEVTYPE
StringMPE/iX device type
-52DEVICE TYPE INTEGER
INTDEVTYPE
IntegerMPE/iX device type
53 RELEASED BooleanSecured/Released
56 COMPRESSED BooleanCompressed/un-compressed (HSM)
57 MIGRATED BooleanMigrated/Not migrated (HSM)
58 SECTORS
NUM SECTORS
IntegerNumber of sectors occupied by the file
59 EXTENTS
NUM EXTENTS
IntegerNumber of extents occupied by the file
60 CREATETIME
FMTCREATETIME
StringFile creation time (CLOCK format).
-60INTCREATETIME
CREATION TIME INTEGER
IntegerFile creation time (CLOCK format).
61 ACCESSORS
NUM ACCESSORS
IntegerNumber of accessors of the file




Appendix B Expression Evaluator Functions


Expression Evaluator Features