HPlogo MPE/iX Commands Reference Manual: HP 3000 MPE/iX Computer Systems > Appendix B Expression Evaluator Functions

References

» 

Technical documentation

Complete book in PDF
» Feedback

 » 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

NumberAliasData TypeItem Description
0EXISTBooleanExistence of file
1FILENAME ONLY FNAME FULL FILENAME FULLFNAME FULLY QUALIFIED FILENAMEStringFile name
2GROUP GROUPNAMEStringGroup name
3ACCOUNT ACCT ACCOUNTNAMEStringAccount name
4CREATORStringFile creator name
5FMTSECURITY FORMATTED SECURITY MATRIXStringSecurity matrix for access
-5SECURITY MATRIX INTSECURITYIntegerSecurity matrix for access
6CREATED CREATION DATE FMTCREATEDStringFile creation date
-6CREATION DATE INTEGER INTCREATEDIntegerFile creation date
7ACCESSED FMTACCESSED LAST ACCESS DATEStringLast access date
-7LAST ACCESS DATE INTEGER INTACCESSEDIntegerLast access date
8MODIFIED LAST MOD DATE FMTMODDATEStringLast modification date
-8LAST MOD DATE INTEGER INTMODDATEIntegerLast modification date
9FILE CODE MNEMONIC FMTFCODEStringFile code of disk file
-9FCODE INTFCODE FILE CODEIntegerFile code of disk file
10USER LABELS WRITTENIntegerNumber of user labels written
11USER LABELS AVAILIntegerNumber of user labels available
12FILE LIMIT LIMITIntegerTotal number of logical records possible in the file
13FORMATTED FOPTIONS FMTFOPTStringFile options
-13FOPTIONS INTFOPTIntegerFile options
14RECORD SIZE RECSIZEIntegerRecord size
15BLOCK SIZE BLKSIZEIntegerBlock size
16MAX EXTENTS MAXEXTIntegerMaximum number of extents
17LAST EXTENT SIZE LASTEXTSIZEIntegerLast extent size
18EXTENT SIZE EXTSIZEIntegerExtent size
19END OF FILE EOFIntegerNumber of logical records in file
20ALLOC TIME FMTALLOCTIMEStringFile allocation time
-20ALLOC TIME INTEGER INTALLOCTIMEIntegerFile allocation time
21ALLOC DATE FMTALLOCDATE ALLOCATEDStringFile allocation date
-21ALLOC DATE INTEGER INTALLOCDATEIntegerFile allocation date
22NUM OPEN CLOSE RECSIntegerNumber of open/close records
23DEVICE NAME DEV NAMEStringDevice name (8 bytes
24FMTMODTIME LAST MOD TIMEStringLast modification time
-24INTMODTIME LAST MOD TIMEIntegerLast modification time
25FIRST USER LABELStringFirst user label (user label 0)
27UNIQUE FILE ID UFIDStringUnique file identifier (UFID)
28BYTE FILE SIZE BYTEFILESIZEIntegerTotal number of bytes allowed in file
29BYTE DATA OFFSET DATASTARTIntegerStart of file offset
30BYTE RECORD SIZE BYTERECSIZEIntegerRecord size (indicates bytes)
31BYTE BLOCK SIZE BYTEBLKSIZEIntegerBlock size (indicates bytes)
32BYTE EXTENT SIZE BYTEEXTSIZEIntegerExtent size (indicates bytes)
33LOCKWORDStringFile lockword
34VOLUME RESTRICTION VOLRESTRStringVolume restriction
35VOLUME SET NAMEStringVolume set names
36LOG SET IDStringTransaction management log set id
37LDEV LOGICAL DEVICE NUMBERIntegerLogical device number
38POSIX FULL FILE NAME POSIXFULLFNAMEStringTerminated HFS-syntax system absolute pathname
39NUM HARD LINKS NUMHARDLINKSIntegerThe current number of hard links to the file
40ACCESS TIME FMTACCESSTIME LAST ACCESS TIMEStringTime of last file access (clock format)
-40LAST ACCESS TIME INTEGER INTACCESSTIMEIntegerTime of last file access (clock format)
41STATUS CHANGE TIME FMTSTATUSCHANGETIMEStringTime of last file status change (clock format)
-41INTSTATUSCHANGETIME CHANGE TIME INTEGERIntegerChange Time Integer
42STATUS CHANGE DATE FMTSTATUSCHANGEDATEStringDate of the last file status change (calendar format)
-42CHANGE DATE INTEGER INTSTATUSCHANGEDATEIntegerDate of the last file status change (calendar format)
43FILE OWNER NAME OWNERStringFile owner
44FILE OWNER ID UIDIntegerFile owner identifier
45FILE GROUP NAME FILEGROUPStringFile group
46FILE GROUP ID GIDIntegerFile group identifier
47FILE TYPE FILETYPEStringFile type
-47FILE TYPE INTEGER INTFILETYPEIntegerFile type
48RECORD TYPE RECTYPEIntegerRecord type
49BYTE FILE SIZE BYTEFILESIZEIntegerCurrent file size (in bytes)
50KSAM VERSION KSAMVERS IntegerKSAM XL file version
51KSAM LABEL KSAMPARAMStringKSAM XL parameters
52DEVICE TYPE DEVTYPEStringMPE/iX device type
-52DEVICE TYPE INTEGER INTDEVTYPEIntegerMPE/iX device type
53RELEASEDBooleanSecured/Released
56COMPRESSEDBooleanCompressed/un-compressed (HSM)
57MIGRATEDBooleanMigrated/Not migrated (HSM)
58SECTORS NUM SECTORSIntegerNumber of sectors occupied by the file
59ESTENTS NUM EXTENTSIntegerNumber of extents occupied by the file
60CREATETIME FMTCREATETIME INTEGERStringFile creation time (CLOCK format).
-60INTCREATETIME CREATION TIME INTEGERIntegerFile creation time (CLOCK format).
61ACCESSORS NUM ACCESSORSIntegerNumber of accessors of the file

 

Feedback to webmaster