|
![]() | ![]() ![]() ![]() ![]() ![]() ![]() ![]() | Functions |
PROGRAM
. The functions are listed by type and in alphabetical order with a full explanation of each.
In a case structured database, the across record functions return a value for each case. Specify the
The functions all ignore values that are undefined and most also ignore missing/excluded values. The
<
attribute of nth tabfile
Returns the absolute value of X.
Returns the arc cosine of X. The result is in the range 0 to pi radians. Values of X outside the range -1 to 1 return undefined.
Returns the truncated value of X. If
Returns the natural logarithm (base e) of X. Values less than or
equal to zero return undefined.
Returns the base 10 logarithm of X. Values less than or equal to
zero return undefined.
Returns the remainder of X divided by Y. If Y is zero, undefined is
returned.
Returns SIR/XS application directory. That is the directory where the SIR/XS executables are installed.
See
Returns the number of dimensions for specified local array variable.
Returns the start value for the specified dimension for specified local array variable (normally 1 unless array specified to start at different value).
Returns the size of the specified dimension for specified local array variable.
See
See
Returns the arc sine of X. The result is in the range
-
Returns the arctangent of X. The result is in the range pi/2 to +pi/2 radians.
Returns the nth attribute.
Binds an sqlserver/odbc parameter.
Creates a new node under the given parent node in the tree control.
Deletes a branch in the tree control given by the node.
Returns id of nth child of the given node.
Returns the buffer number of the specified buffer name. Returns zero if the buffer name does not exist. Note that buffers are maintained in alphabetical order
so the number of any specific buffer may change during a session.
Returns the number of lines in the specified buffer. Returns -1 if the buffer name does not exist. A zero return value indicates an existing, empty buffer.
Returns the nth buffer name (
Capitalises the first alphabetic character of the string and the
first alphabetic character following a blank. All other characters remain
unedited. For example:
Changes the lock type for the current Case (CIR) and attempts to read
the current CIR from the database. See
1 = Exclusive
Returns an integer corresponding to the category in categorical
variable A that B matches. A and B may be variables, string constants or
expressions. Returns a zero if no match is found.
Returns a string corresponding to the current value of the specified
categorical variable.
Returns the date integer equivalent to the date string X that may be a string constant, variable or expression. The date format is a string expression. See date formats for a complete description.
If a date earlier than October 15, 1582 is specified, undefined is returned. Example:
Returns string strY centred in a string X characters in length.
Example:
Used when dealing with CGI from webserver. Puts value of CGI parameter into named buffer. Returns number of lines. Parameters are string expressions.
Used when dealing with CGI from webserver. Puts value of server variable into named buffer. Returns number of lines. Parameters are string expressions.
Used when dealing with CGI from webserver. Returns named parameter value in string variable. Parameter name is a string expression.
Used when dealing with CGI from webserver. Returns named server variable value in string variable. Server variable name is a string expression.
Returns a single character. The character returned is the character with the ASCII value of N. (See the
Returns a hexadecimal representation of the input string. The ASCII value of each character is converted to hexadecimal. (
The following small program displays each ASCII value (1 to 255) together with the associated character and hexadecimal value (note some values are control characters and give slightly odd results when displayed).
Appends text to the clipboard (the place holding text used in cut and paste).
Gets a line of text from the clipboard (the place holding text used in cut and paste).
Gets number of lines of text currently in the clipboard (the place holding text used in cut and paste).
Clears the clipboard and puts text into the clipboard (the place holding text used in cut and paste).
Counts the number of values in a list that are not missing/excluded or undefined. There may be up to 512 variables in the list.
Returns zero (0) if no values qualified.
Counts the number of values in a list that exist (not undefined). There may be up to 512 variables in the list.
Returns zero (0) if no values exist. The count includes values defined as excluded.
Returns the number of values of X found during a
Returns the number of values of X found during a
Client/Server function. Returns a count of columns created by the execute.
Client/Server function. Returns the label of a specific column created by the execute.
Client/Server function. Returns the length of a specific string column created by the execute.
Client/Server function. Returns the name of a specific column created by the execute.
Client/Server function. Returns the type of a specific column
created by the execute. This is one of the following:
A timestamp string is a formatted 18 byte string containing a combination date/time as follows:
Client/Server function. Returns the numeric value of a
specific column created by the execute. This does not have to be the same type as returned by
Client/Server function. Returns the string value of a
specific column created by the execute.
Places a comma between every third digit to the left of a decimal point (actual or implied) in a string with a numeric form. For example,
Returns the trigonometric cosine of X, where X is measured in
radians.
Copies a file from oldname_str to newname_str. Returns 0 for a success, -1 for a problem opening the source file, -2 for a problem opening the target file and -3 for errors during the copy.
Sets the key used by the encryption functions
The specified key is an expression. i.e. a variable name or a string in quotes.
Returns the number of records for record type X within the current
case.
Returns the number of seconds from midnight to the given time.
Returns the current directory.
Returns the record type number for the record currently being processed in a
Returns a date string equivalent to the date integer X formatted according to the date format. The format is a string constant. See date formats for a complete description. For example,
Returns a string with the date format (map) of the specified date variable. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Returns name of nth index.
Returns number of record type indexed by nth index.
Returns number of indexes on default database.
Name of nth variable in nth index plus ASC/DESC and UPPER.
Returns 1 if the index is unique or 0 if the index is not unique.
Returns number of variables in nth index.
Returns a string with the name of the attribute of the first file of the nth attached database. If n is zero, returns the attribute of the first file of the default database.
The attribute is a SIR/XS name in the format
Returns the name of the nth database in the connected databases table.
Note: Databases do not change position in this table while they are connected and so there may be entries for disconnected databases when the disconnected database is in the middle of connected databases. A disconnected database returns a zero length name.
Returns the number of an attached database. If name is not found, returns 0. The name is an expression - specify the name in quotes if it is specified directly.
A zero length or blank string returns the position of the first disconnected database if one exists in the table.
Returns a string which is the fully qualified directory of the nth attached database. If n is zero, returns the directory of the default database. The same string would be returned by the
Returns 1 if the default database is a case structured database or 0 if caseless.
Decrypts an encrypted string. Set the encryption key (using
Returns the default family name.
Returns the default member name.
Returns the default tabfile name.
Deletes the named directory. Returns 0 for success.
Deletes the named file use full filename not an attribute. Returns 0 for success.
Deletes the client from master. Get the client id from
Deletes a global. The string expression may be the global name enclosed in quotes or a string variable.
The
Returns the operating system filename of an attribute. The specification of the attribute may be a variable or constant.
Takes a date and time integer and returns a timestamp. A timestamp is a real*8 representation and is the number of seconds since the start of the SIR/XS calendar. Extract the individual date and time components with the
Applies an edit string to data to produce the output. The edit string is made up of circumflexes ( ^ ), that represent a character of the input string, and any other characters to insert. Example:
Returns the name of the current text editor.
Encrypts a string. Set the encryption key (using
Displays an error box with the specified text and waits for
acknowledgment.
Returns 1 if X exists, 0 if X is missing or undefined. To test
several numeric variables for existence, use the
Returns 1 if X exists or has a defined missing/excluded value, Returns 0 if X is undefined. To test
several numeric variables for the same values, use the
Returns 1 if any X exists, 0 if all X processed so far were missing or undefined
during a
Returns 1 if any X exists or had a user defined missing/excluded value, 0 if all X processed so far were undefined.
during a
Returns the value of e raised to the X power. e is the
constant 2.71828.
Invokes a user-supplied external function from the
Invokes a user-supplied external function from the
Returns the nth family name in the default procedure file. (
Tests two floating point numbers for equality within a limit of accuracy. The function returns 0 if approximately equal, 1 if unequal. For example, if the exponent was -3, the numbers would be equal if within .001.
Counts the files in the directory given by the string argument. The string must be a filename or mask. For example, specify a mask like '*.pql' for the count of those files with extension "pql" in the current directory.
Displays a file browse box for user to choose existing file. Returns zero length string if user cancels.
Tests if file exists. Returns -1 if name is a directory; 0 if no such name; 1 if file exists.
Returns the nth file name in the directory given by the string argument.
The string must be a filename or mask. For example, to list all files with extension "pql" in the current directory:
Displays a file browse box for user to choose output file. Returns zero length string if user cancels.
Returns various system specific data about a named file.
Returns SIR/XS time or date integers about a file.
Replaces all blank characters in strX with the first character of string argument strY. The length of strX does not change. For example:
Search dialog choice or list for text and return position. Can start from partway through.
Converts X to a string.
Returns the first value in the list of up to 512 variables that is not missing or undefined.
Returns the first value of X encountered during a
Returns the height of button control (for positioning).
Returns the height of choice control( for positioning).
Returns the height of check control( for positioning).
Returns automatic disconnection timeout for idle clients (from Master) in minutes.
Returns time (from Master) of difference file copy interval in minutes.
Returns the value of the named environment variable.
Client/server function. Returns the oldest error posted for this application and deletes the message. Returns a zero length string if no messages. Errors are not specific to a connection or statement, rather they are posted for this instance of SIR/XS and, if errors are not retrieved when an error condition occurs, multiple error messages may be waiting. One logical error may also give rise to multiple error messages from the server.
Gets floating point as per
Returns id of control with focus.
Returns check or radio state.
Returns floating point from a list.
Returns integer of item from a list.
Gets integer as per
Returns text of item from a list.
Returns the height of labels ( for positioning).
Gets the text from a line in a multi-line text control.
Returns the height of the maximum single line control ( for positioning).
Returns tcp/ip address for client from master.
Returns check state from menu item.
Returns id for nth client from master.
Returns time of last message for nth client from master.
Returns time of log on for nth client from master.
Returns name of nth database from master.
Returns the position of the nth selected item from a single or multiple selection list.
In the case of a single selection list then
Returns number of items in choice or list.
Gets number of lines in multi-line text.
Returns number of items selected in multiple selection or returns 1 for a single selection list.
Returns pos of current selection in list or choice or keyboard focus in multiple selection.
Returns the height of radio control (for positioning).
Returns the size of the row step (for positioning).
Gets text from edit and from highlighted item in choice or list. Gets label text from label, button, check and radio.
Returns the height of text control for positioning.
Assigns a numeric value to a global variable. The first argument is the name of the global variable, the second argument is the numeric expression which can be a single variable name. For example: To assign the global variable RT the value 25.5:
Assigns a string value to a global variable. The first argument is the name of the global variable, the second argument is the string expression which can be a single variable name). For example: To assign the global variable
It would be a mistake to try to use the value of globals set by
Returns the name of the nth global variable. (
The
The function can also be used to generate a single hash string for multiple strings. In this mode, first initialise the function with a call where the type is '1', then call the function multiple times with the string values and a type of '2' and finally call the function with a type of '3' to return the final hash string value. Note that the values in the source string on the type 1 & 3 calls are irrelevant.
For example, a whole set of records could be processed and a single hash generated that could be subsequently checked in the same way to ensure there had been no changes in the data. e.g.
Invokes the HELP system, beginning with the specified help page. The page must be in html format in the help directory. The page name can contain directory names using forward slashes to delimit. Enclose the name in quotes. The system converts this to a file name prefixed with a path pointing to the help directory and suffixed with the file extension
Converts the hexadecimal values of the ASCII codes in the input string to their associated characters. See
Returns the ASCII value of the first character in string C.
Returns the status of a GUI element. -1 = the control does not exist; 0 = the control is disabled; 1 = the control is enabled.
Returns whether journaling is on (1) or off (0) for the database.
Converts a date integer, X, into an 12-character string of the form
Returns a date integer where the three numeric arguments are month, day and year. A date integer is the number of days since the start of the Gregorian calendar on October 15, 1582.
Years can be specified in various ways:
Returns the name of the specified keyfield for the specified record type.
Returns "A" or "D" for the sort order of the specified keyfield. The variable name argument is an expression.
Returns an integer value that is the length, in characters, of the string strX, leading and trailing blanks included.
See
Returns number of lines remaining on current page being written to a file.
See
See
See
Returns the string with all characters converted to lower case.
Returns the last value in the list of up to 512 variables that is not missing or undefined.
Returns the last value of X encountered in a
Creates a new directory using the name. Returns -1 if the directory cannot be created.
Returns the maximum value in the list of up to 512 variables.
Returns the maximum value of the specified variable encountered during a
Returns the maximum number of records allowed for this record type.
Returns the mean (arithmetic average), of the values within the list that are not missing or undefined. The maximum number of variables allowed in the argument list is 512.
Returns the mean (arithmetic average), for the values of the specified variable encountered during a
Returns the count of members in the named family of the default procedure file.
Returns information about the named member. The member name can include the type qualifier (a letter after a colon at the end of the name).
The function returns missing if the member does not exist.
The infotype is a number between 1 and 8 as follows:
Returns the name of the nth members in the named family of the default procedure file.
Returns the minimum value in the list of up to 512 variables.
Returns the minimum value of the specified variable encountered during a
If X is undefined, 0 is returned. If X is missing/excluded, the missing type is returned (1, 2 or 3). If X is neither missing/excluded nor undefined, undefined is returned. X may be a numeric or string variable.
Returns the original value for first, second and third missing/excluded values as a string, where n is 1, 2, or 3. If the record number (rtnum) is negative, the function applies to a local variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Returns the original value of a variable if it is missing/excluded, otherwise undefined is returned. If the variable is a time, date, or categorical integer, the original string value is returned. If the variable is an integer or floating point variable, the original numeric value is returned. If the argument is not a single variable name, undefined is returned.
To illustrate the three functions:
Returns the maximum key size in bytes for the database. The key for a record is comprised of the case identifier (in a case structured database), the record type number, and the keyfields defined for the record type (if any).
Refer to the schema definition command
Returns the size of the largest record type in the database. Size is expressed in the number of double words that are equivalent to eight characters.
Returns the text of the error or warning massage given by the number
Parameters can be specified
when initiating a command stream and are often used for text substitution. These parameters can also be accessed at execution time with the
Returns number of branches of the given node in a tree control.
Returns 1 if the variable value is undefined i.e. is set to system missing. Returns 0 if variable contains valid value (including user defined excluded/missing values).
Client/server function. Steps through the rows one at a time. This must be issued before getting data for the first row. Returns the row number or zero if no more rows.
Returns the value of the specified numeric variable. The variable name is specified as a string variable, quoted string constant or string expression whose value is the name of a common, record or program variable.
Returns the numeric value of a global variable. The argument is a string variable, a constant or a string expression that specifies a global variable name. If the value is not a defined global variable or the global variable value is not numeric, undefined is returned. (Use
Returns the number of keyfields (sort-ids) for the specified record type (excluding the case id).
See
Returns the highest valid numeric value for the specified variable. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Returns the lowest valid numeric value for the specified variable. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Returns the current maximum number of cases as defined in the schema See
Returns a "time integer" representing the current time of day as the number of seconds since midnight. The argument is a dummy argument, specify zero.
Stores the value of numeric argument Y in numeric variable A. A is a string variable name, quoted string constant or string expression whose value is the name of a common, record, or program variable. The value returned by the
function is the value actually stored in A (possibly undefined, missing, etc.). If A refers to a common or record variable, the Retrieval must be in update mode. The following example stores 175 in the variable Height:
Pops up a box on the screen with a prompt and returns a number from the user.
If a non-numeric field is entered, a message is issued and the user is prompted again.
Returns the maximum number of record types for the database. This is the maximum possible number of record types, not the actual number of record types defined for the database.
Returns the name of the nth sub-directory.
Returns the numeric value of the string strX. strX is a string constant, variable name or expression and contains only numerical characters, at most one decimal point and a plus or minus sign or is in E+exponent format.
Tests whether the numeric value of the string strX is valid.
strX is a string constant, variable name or expression and contains only numerical characters, at most one decimal point and a plus or minus sign or is in E+exponent format.
Returns following codes:
Returns the number of cases in the database. Same as functions
Returns the number of records of the specified record type.
Returns the number of valid values for the specified variable. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Returns the number of value labels defined for a variable.
Returns the number of lines of documentation defined for a variable. Variable documentation does not apply to a summary variables. (Use comment lines in programs for documentation.)
See
Returns the number of variables (not Common) defined in the specified record type.
Returns the number of variables (including Common) defined in the specified record type.
Returns the value of the nth valid value of a numeric variable. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
Client/server function. Does an ODBC query that produces a result set that contains a
list of columns from the named table on the data source and can be interrogated using the
standard functions.
Trigonometric Functions
ACOS
arc cosine (also ARCOS
)ASIN
arc sine (also ARSIN
)ATAN
arc tangentCOS
trigonometric cosineSIN
trigonometric sineTAN
trigonometric tangentTANH
hyperbolic tangent
Mathematical Functions
ABS
absolute valueAINT
truncation (also TRUNC
)ALOG
natural logarithm (also LN
or LOG
)ALOG10
base 10 logarithm (also LG10
or LOG10
)AMOD
remainder of division (also MOD
)EXP
exponentiation (base e)FEQ
compares two floating point numbers within a toleranceRAND
random uniform number (0-1) (also RANF
)REAL4
returns the REAL*4
value of a
REAL*8
numberRND
roundingSIGN
transfer of signSQRT
square rootTRUNC
truncates least significant digits
Argument List Functions
CNT
count the number of arguments that are not missing or undefinedFST
return the first argument that is not missing or undefinedLST
return the last argument that is not missing or undefinedMAX
return the largest argument that is not missing or undefinedMEAN
compute the mean of the arguments that are not missing or undefinedMIN
return the smallest argument that is not missing or undefinedSTDEV
compute the standard deviation of non missing values i.e. values that are not missing or undefinedSUM
compute the sum of all arguments that are not missing
Across Record Functions
The "across records" functions compute a result based on a single variable in each record or row processed in the PROCESS REC
or
PROCESS ROW
block and the functions may only appear in these blocks.CASEFUNR
keyword on the PROCESS RECORD
command to calculate results over all records in all cases.CNTRX
and EXISTSRX
versions of the CNTR
and EXISTSR
functions only ignore undefined i.e. they include user defined excluded values.CNTR, CNTRX, EXISTSR, EXISTSRX, FSTR, LSTR, MAXR, MINR, FST, LST, MAX, MIN
can all be used with strings. If a function returns a string (e.g. as a maximum), a maximum of 32 characters are returned.MEANR,STDEVR,SUMR,AMOD,MEAN,STDVEV,SUM
are only relevant to numeric values.CNTR
counts the number of times the variable occurs.CNTRX
counts the number of times the variable occurs including user defined missing/excluded values.EXISTSR
returns 1 if the variable occurs during the process.EXISTSRX
returns 1 if the variable occurs during the process including user defined missing/excluded values.FSTR
returns the first value processed.LSTR
returns the last value processedMAXR
returns the largest value processedMEANR
computes the average value (SUMR / CNTR
)MINR
returns the smallest valueSTDEVR
computes the standard deviationSUMR
computes the sum of values
Date and Time Functions
CDATE
converts a date string to a date integerCTIME
converts a time string to a time integerDATEC
converts a date integer to a date stringDATET
returns the current date and time as a stringDTTOTS
takes a date and a time integer and returns a Timestamp as a real*8 valueJULC
converts a date integer to a date stringJULN
converts day, month, and year to a date integerNOW
returns the current time as a time integerTIME
converts hours, minutes, and seconds to a time integerTIMEC
converts a time integer to a time stringTODAY
returns current date as a date integerTSTODT
takes a Timestamp and returns the date component as an integerTSTOTM
takes a Timestamp and returns the time component as an integer
Global Functions
DGLOBAL
Deletes a global variableDSN
Returns a full filename associated with an attributeGLOBALN
Assigns a numeric value to a global variableGLOBALS
Assigns a string value to a global variableNARG
Returns a numeric parameter from execution parameter listNGLOBAL
Returns the value of a global numeric variableSARG
Returns a string parameter from execution parameter listSGLOBAL
Returns the value of a global string variable
String Functions
CAPITAL
Capitalises the first letter of each word in stringCATINT
Returns an integer value of a categorical variableCATSTR
Returns a string value of a categorical variableCENTER
Returns a centred stringCHAR
Returns the character with the numeric internal valueCHARHEX
Converts a character or character string into a hex representation of the character codes.COMMA
Separates thousands by inserting commas in a numeric stringEDIT
Applies editing template to a data stringFILL
Replaces blanks in stringFORMAT
Converts a number to a stringHEXCHAR
Converts a hex representation of a character string into the ASCII characters.ICHAR
Returns the numeric internal value of a characterLEN
Returns the string length in charactersLOWER
Converts all characters in string to lower caseNUMBR
Converts a string to a numberNUMBRC
Tests if a string represents a valid numberPACK
Returns the string with compressed blanksPAD
Pads a string with character to specified lengthPATTERN
Returns whether a pattern is found in a stringPFORMAT
Converts a number to a formatted stringPICTURE
Validates a string by comparing to a pictureREGEXP
Searches a string for a substring specified by a regular expressionREGREP
Searches a string for a substring specified by a regular expression and replaces it according to a second regular expressionREPLACE
Replaces substrings with a specified stringREVERSE
Returns a string spelled backwardsSBST
Returns a substring of a stringSGET
Returns the value of a string variableSPREAD
Returns a string with single blanks between charactersSPUT
Stores string value in string variableSRST
Searches for a substringSUBSTR
Returns a substring of a stringTRIM
Trims trailing blanks from a stringTRIML
Deletes blanks from the leftTRIMLR
Deletes blanks from the left and the rightTRIMR
Deletes blanks from the rightUPPER
Converts all characters of string to upper caseVARGET
Gets value from string variable where variable name is an expression.VARPUT
Puts value into string variable where variable name is an expression.
Concurrent Functions
CASELOCK
Change lock type for and retry current CIR (also CIRLOCK
)RECLOCK
Change lock type for and retry current recordSYSTEM(36)
Whether current record is lockedSYSTEM(37)
Whether current CIR is lockedSYSTEM(38)
Whether a concurrent session using MasterSYSTEM(39)
Returns the ordinal number of the default database. No Database returns 0
Miscellaneous Functions
ARRDIMN
Returns number of dimensions of a local array variableARRDIMST
Returns start value of a dimension of a local array variableARRDIMSZ
Returns number of entries of a dimension of a local array variableCLIPAPP
Adds text to the clipboardCLIPGET
Gets text from the clipboardCLIPLINE
Gets count of lines in the clipboardCLIPSET
Clears the clipboard and adds text to the clipboardCRYPTKEY
Sets the key for the encryption functions.CURREC
Returns the record type (number) for the record currently being processed.DECRYPT
Decrypts an encrypted string.ENCRYPT
Encrypts a string.ERROR
Displays a text message error boxEXISTS
Indicates if variable exists (not a missing/excluded value or undefined)EXISTSX
Indicates if variable exists (not undefined)EXTERN
Invokes user-supplied external functions returning a numeric value. These must be in the EXTERN
dll.EXTERNS
Invokes user-supplied external functions returning a string value. These must be in the EXTERN
dll.HASH
Generates an encrypted hash string.HELP
Invokes the Help systemMISNUM
Tests the value of a specific variable and returns 0 if undefined and the missing/excluded number (1,2 or 3) if missing/excluded MISS
Returns the original value for first, second or third missing/excluded values given a record number and variable nameMISSING
Returns the original value for a missing/excluded value for a specific variableMSGTXT
Returns the error message text for an error numberNEXISTS
Indicates if variable is undefined)PROGRESS
Controls the display of a progress barSEEK
Sets a position on an open file.SRCH
Searches a table of valuesSTDNAME
Checks a name and wraps curly brackets around if it is a non-standard name.
SYSTEM
Returns various system values such as CPU time used, whether a
database access has been successful, etc.YESNO
Displays a text question box and returns response
Session Functions
APPDIR
Returns the application directoryATTRNAME
Returns the nth attribute nameBUFEXIST
Returns the buffer number of buffer nameBUFLINES
Returns the number of lines in buffer nameBUFNAME
Returns the nth buffer nameCPYFILE
Copies a fileCURDIR
Returns the current directoryDEFFAM
Returns the default family nameDEFMEM
Returns the default member nameDEFTFN
Returns the default tabfile nameDELDIR
Deletes the named directoryDELFILE
Deletes the named fileEDITNAME
Returns the editor nameFAMNAME
Returns the nth family name FILECNT
Returns a count of files in named directoryFILEIN
Browses for a fileFILEIS
Returns if name exists as file or directoryFILEN
Returns the nth file in directoryFILEOUT
Browses for an output fileFILESTAT
Returns various data about named file e.g. Date/time of creation/access, size of file, etc. Times and dates are in system formatFILETIME
Returns various data about times of creation/access of file with times and dates converted to SIR/XS formatsGETENV
Gets a string environment variable valueGLOBNAME
Gets the name of the nth global variableLINES
Returns the lines remaining on output pageMAKEDIR
Creates a directoryMEMCOUNT
Returns the count of members in familyMEMINFO
Returns various information about a memberMEMNAME
Returns the name of nth memberNSUBDIR
Returns the name of nth subdirectoryOUTFNAME
Returns the name of current output filePAGELEN
Returns the length of output pagePAGENO
Returns the current output page numberPAGEWID
Returns the width of output pagePROCFILE
Returns the procedure file attributePROCNAME
Returns the procedure file filenameRACCESS
Returns the read access level of userRNMFILE
Renames a file or directorySETDIR
Sets current directorySETRC
Sets a return codeSIRUSER
Sets/returns the current user nameSUBDIR
Concatenates a subdirectory to existing directory path in correct system specific mannerSYSTEM
Returns various "system" status valuesUPGET
Gets User Preference (from INI file)UPSET
Sets User Preference (in INI file) WACCESS
Returns the write access level of userWINCNT
Returns the number of lines in the output windowWINLIN
Returns the nth line from the output windowWINMOVE
Moves and resizes the main windowWINPOS
Moves to line in output windowWINSELL
Returns selected line from output windowWINSELP
Returns position in line selected from output window
Schema & Database Functions
COUNT
Returns the number of records of a given type in the current caseDATEMAP
Returns the date format (map) of a date variableDBINDN
Returns the name of nth index on default databaseDBINDR
Returns the number of record type indexedDBINDS
Returns the number of indexes on default databaseDBINDT
Returns the name of the nth variable in index followed by either ASC or DESC and UPPER if uppercase indexDBINDU
Returns 1 if index is uniqueDBINDV
Returns the number of variables in indexDBATTR
Returns the attribute of first file of the nth database. Zero returns the attribute of the default database.DBNAME
Returns the name of the nth connected database. DBNUM
Returns the number (nth in the database table) of the named database (DBNO
is a synonym.) DBPRE
Returns the prefix of the nth database. Zero returns the prefix of the default database.DBTYPE
Returns database type, case or caseless of current databaseJOUFLAG
Returns whether journaling is on for default databaseKEYNAME
Returns name of a record type key fieldKEYORDER
Returns sort order ("A" or "D") of a key fieldMAXRECS
Returns the maximum allowed number of a particular record typeMISS
Returns the original (string) for missing values (0 - 3) for a variableMKEYSIZE
Returns the size of the largest record key in the databaseMRECSIZE
Returns size of the largest record in the databaseNKEYS
Returns the number of key fields for a record typeNLABELS
Synonym for NVALLAB. Returns the number of variable value labels defined for a variableNMAX
Returns the maximum value of a numeric variable rangeNMIN
Returns the minimum value of a numeric variable rangeNOFCASES
Returns the maximum number of cases for the databaseNRECS
Returns the maximum number of record types for the databaseNUMCASES
Returns the number of cases in the databaseNUMRECS
Returns the number of records of a given type in the databaseNVALID
Returns the number of defined valid values for a variableNVALLAB
Returns the number of variable value labels defined for a variableNVARDOC
Returns the number of lines of variable documentation defined for a variableNVARS
Returns the number of variables for the specified record typeNVARSC
Returns the number of variables including common vars for the specified record typeNVVAL
Returns the nth valid value of a numeric variableRECDOC
Returns the nth line of documentation for a record or databaseRECDOCN
Returns the number of lines of documentation for a recordRECLEVEL
Returns the update level at which a record was last written to databaseRECNAME
Returns the name of the record typeRECNUM
Returns the number of the record nameRECSIZE
Returns the record size of a specified record typeRKEYSIZE
Returns the key size of a specified record typeRRECSEC
Returns the read security level of a record typeRVARSEC
Returns the read security level of a variableSMAX
Returns the maximum value of a string variable rangeSMIN
Returns the minimum value of a string variable rangeSTATTYPE
Returns whether a numeric variable is defined as observation, control
or neitherSVVAL
Returns the nth defined string valid value of a variableTIMEMAP
Returns the time format (map) string format of a time variableUPDLEVEL
Returns the current update level of databaseVALIDATE
Validates a value of a database variable against schemaVALLAB
Returns the value label for the current value of a variableVALLABSC
Returns the value label for a specified value of a variableVALLABSN
Returns the nth value label of a variableVALLABSP
Returns the number (nth) of the value label associated with a specified value of a variable.VALLABSV
Returns a string that is the nth value associated with value labels of a variable.VARLAB
Returns the variable label for a variable (up to 254 characters)VARLABSC
Returns the variable label of a specified variable (up to 254 characters)VARDOCSN
Returns the nth line of variable documentation of a specified variableVARNAME
Returns the name of the variable using counts excluding common vars.VARNAMEC
Returns the name of the variable using counts including common vars.VARPOSIT
Returns the input position of the variableVARTYPE
Returns the storage type of a variable (string or numeric)VFORMAT
Returns a string representing the variable input formatVSCALE
Returns the scaling factor for a scaled integerVSCHFMT
Returns the variable input output format as shown in the schema DATA LISTVTYPE
Returns the SIR/XS data type of a variable (7 types)VXLEN
Returns the number of characters required to display the variableWRECSEC
Returns the write security level of a record typeWVARSEC
Returns the write security level of a variable
Tabfile & Table Functions
TABINDN
Returns the index name of nth indexTABINDS
Returns the number of indexes on nth tableTABINDT
Returns the variable name and sequence of nth variable on indexTABINDU
Returns 1
if nth index is unique. Returns zero (0
) if not uniqueTABINDV
Returns the number of variables in nth indexTABNAME
Returns the name of nth tableTABRECS
Returns the number of rows on nth tableTABVARS
Returns the number of cols (variables) in nth tableTABVINFN
Returns various numeric data about columnTABVINFS
Returns various string data about columnTABVNAME
Returns the column nameTABVRANG
Returns the value of valid/missing range for columnTABVTYPE
Returns the column typeTABVVALI
Validates table columnTABVVLAB
Returns the value label for table columnTABVVVAL
Returns the value label value for table columnTFACCESS
Returns the access a(uto),r(ead) w(rite) of nth tabfileTFCOUNT
Returns the number of connected tabfilesTFFILE
Returns the filename of nth tabfileTFGRNAME
Returns the group name of nth tabfileTFGRPW
Returns the group password of nth tabfileTFJNNAME
Returns the journal name of nth tabfileTFNAME
Returns the name of nth tabfileTFTABS
Returns the number of tables on nth tabfileTFUSNAME
Returns the user name of nth tabfileTFUSPW
Returns the user password of nth tabfile
Read/Write Functions
NGET
Gets the value of a numeric variableNPUT
Stores a value in a numeric variableNREAD
Pops up a box on the screen with a prompt and returns a number from the userSGET
Gets the value of a string variableSPUT
Stores a value in a string variableSREAD
Pops up a box on the screen with a prompt and returns a string from the userTWRITE
Writes a string to the scrolled output window
Dialog & Menu Functions
BRANCH
Adds a branch to the tree at a particular place.BRANCHD
Deletes a branch from the tree.BRANCHN
Returns id of nth branch.FINDITEM
Search list for textGETBTNH
Returns the height of button controlGETCHCH
Returns the height of choice controlGETCHKH
Returns the height of check controlGETFLT
Gets floating point as per GETTXT
GETFOCUS
Returns id of control with focusGETICHK
Returns check or radio stateGETIFLT
Returns floating point from a listGETIINT
Returns integer of item from a listGETINT
Gets integer as per GETTXT
. 0 if not integerGETITXT
Returns text of item from a listGETLBLH
Returns the height of labelsGETLTXT
Gets the text from a line in a multi-line text controlGETMAXCH
Returns the height of the maximum single line controlGETMCHK
Tests the state of a menu or toolbar itemGETMSEL
Returns pos of nth selected item from multiple selectionGETNITEM
Returns number of items in choice or listGETNLINE
Gets number of lines in multi-line text controlGETNSEL
Returns number of items selected in multiple selectionGETPOS
Returns pos of current selection in list or choice or keyboard focus in multiple selectionGETRADH
Returns the height of radio controlGETRSTEP
Returns the size of the row stepGETTXT
Gets text from edit and from highlighted item in choice or list. (Gets label text from label, button, check and radio)GETTXTH
Returns the height of text controlIDSTATUS
Returns the status of a controlNBRANCH
Returns number of braches in a tree below a point.SCROLLAT
Gets a position in a GUI scrollable itemSCROLLTO
Sets a position in a GUI scrollable itemSETPOS
Sets a position in a GUI multi-line itemSETRANGE
Sets minimum/maximum values in a GUI slider/spin/progress control. Sets the maximum number of characters allowed in
an edit or text field (ignoring the minimum parameter).Dialog Editor
DITEM...
There are a number of functions that return information about items on a DEDIT
dialog, that is a dialog used for screen painting. These functions are all named DITEMxxx
.
Client/Server Functions
There are three servers in SIR/XS and a client program may be communicating with one of those or with an ODBC server from another software supplier. The three SIR/XS servers are Master that controls concurrent updates, the SQLServer, that acts as an ODBC server for other packages, and the PQLServer that is a server that can run any SIR/XS processes requested by a client. Most communication with master is done transparently i.e. it does not require specific functions, however there are a set of functions that can be used to administer master if required.
Client Functions to administer Master
DELMCLID
Deletes the client from Master.GETAKL
Returns the client AutoKill Limit from Master.GETDFC
Returns the difference file copy interval from Master.GETMCADD
Returns the client tcp/ip address from Master.GETMCLID
Returns the nth client id from Master.GETMCLST
Returns the time of last message for nth client from Master.GETMCON
Returns the time of log on for nth client from Master.GETMDBN
Returns the name for nth database from Master.SETAKL
Sets the AutoKill time Limit for master clients.SETDFC
Sets the difference file copy interval for Master.Client Functions to SQLServer/ODBC
BINDPARM
Binds an SQLServer/ODBC parameter.COLCOUNT
Returns a count of columns created by the executeCOLLABEL
Returns the label of a specific column created by the executeCOLLEN
Returns the length of a specific string column created by the executeCOLNAME
Returns the name of a specific column created by the executeCOLTYPE
Returns the type of a specific column created by the executeCOLVALN
Returns the numeric value of a specific column created by the executeCOLVALS
Returns the string value of a specific column created by the executeGETERR
Returns the oldest error posted for this application and deletes the message.NEXTROW
Steps through the rows one at a timeODBCTABS
Produce list of tables on the data sourceODBCCOLS
Produce list of columns from the named table on the data sourceROWCOUNT
Count of rows created by the executeClient Functions to PQLServer
SERADMIN
Various server administration capabilities (returning numeric values)SERADMIS
Various server administration capabilities (returning string values)SEREXEC
Instructs server to execute previously sent commandsSERGET
Gets a line of output from serverSERLINES
Asks server how many lines of output are leftSERLOG
Logs on to the serverSERSEND
Sends a string to the serverSERSENDB
Sends a buffer to the serverSERTEST
Asks server if execution has completedPQLServer Functions
(These have no effect if used in a program that is not running on the server)
SERNOOUT
Suppresses server outputSERWRITE
Writes a line of output from server
CGI Functions
Buffer functions return number of lines. All parameters are string expressions.CGIBUFPN
Get buffer of value of parameterCGIBUFPN
Get buffer of value of parameterCGIBUFSV
Get buffer of value of server variableCGIVARPN
Get parameter valueCGIVARSV
Get server variable value
Alphabetic List of All Functions
A B C D
E F G H
I J K L
M N O P
Q R S T
U V W X
Y ZABS
num = ABS( X )
ACOS
num = ACOS( X )
AINT
num = AINT( X [,n] )
n
is omitted or 0, truncates to an integer value. If n
is specified, truncates to that power of 10. e.g.
AINT (1266,2)
truncates to 1200;
AINT (1.266,-2)
truncates to 1.26.ALOG
num = ALOG( X )
ALOG10
num = ALOG10( X )
AMOD
num = AMOD(X , Y)
APPDIR
str = APPDIR(0)
ARCOS
num = ARCOS( X )
ACOS
function.ARRDIMN
num = ARRDIMN(array_name_exp)
ARRDIMST
num = ARRDIMST(array_name_exp,dim)
ARRDIMSZ
num = ARRDIMSZ(array_name_exp,dim)
ARCOS
num = ARCOS( X )
ACOS
function.ARSIN
num = ARSIN( X )
ASIN
function.ASIN
num = ASIN( X )
pi
/2 to +pi
/2 radians. Values outside the range -1 to 1 return undefined.ATAN
num = ATAN( X )
ATTRNAME
str = ATTRNAME(n)
n = SYSTEM(52)
returns the attribute count.BINDPARM
num = BINDPARM(conid,statid,parmno,num_exp)
BRANCH
num = BRANCH(control_id,parent_id,node_id,text)
BRANCHD
num = BRANCHD(control_id,node)
BRANCHN
num = BRANCHN(control_id,node,n)
BUFEXIST
num = BUFEXIST(buffer_name_expression)
BUFLINES
num = BUFLINES(buffer_name_expression)
BUFNAME
str = BUFNAME(n)
SYSTEM(56) =
buffer count). Note that buffers are maintained in alphabetical order
so the number of any specific buffer may change during a session.CAPITAL
str = CAPITAL( str )
NAME = 'this is the first day of the week'
NAME = CAPITAL(NAME)
Returns: This Is The First Day Of The Week
CASELOCK
num = CASELOCK(locktype)
SYSTEM(37)
function to
determine if current CIR is locked. The locktype
codes are
(any other values set concurrent read):
2 = Concurrent Read
3 = Concurrent Write
4 = Protected Read
5 = Protected Write
6 = Exclusive CATINT
num = CATINT(A, B)
CATSTR
str = CATSTR(A)
CDATE
num = CDATE(X, date format)
INTDATE = CDATE('6/3/16', 'MM/DD/YY')
CENTER
str = CENTER(X , strY)
RESULT = CENTER(9, 'ABC')
returns: " ABC ".
CGIBUFPN
n = CGIBUFPN(buf,pn)
CGIBUFSV
n = CGIBUFSV(buf,sv)
CGIVARPN
str = CGIVARPN(pn)
CGIVARSV
str = CGIVARSV(sv)
CHAR
str = CHAR(N)
ICHAR
function.) If N is larger than 255, N is divided by 256 and the remainder is taken. This gives the set of standard characters. If N is missing, a null string is returned (length 0). For example the value of "H" is 72.CHARHEX
hexstr = CHARHEX(str)
HEXCHAR
converts from hexadecimal to characters.)COMPUTE HEX1 = CHARHEX("Hello World")
This returns 48656C6C6F20576F726C64
as a string. The ASCII value of the first character "H" is decimal 72 and so it is 48 in hexadecimal, the second character "e" is decimal 101 which is 65 in hexadecimal, etc.
PROGRAM
STRING*2 HEXSTR
STRING*1 CHARSTR
FOR I = 1,255
. COMPUTE CHARSTR = CHAR(I)
. COMPUTE HEXSTR = CHARHEX(CHARSTR)
. WRITE I CHARSTR HEXSTR
c These two lines convert a hex character pair to a character then to a decimal
. COMPUTE CHARSTR = HEXCHAR(HEXSTR)
. COMPUTE J = ICHAR(CHARSTR)
ROF
END PROGRAM
See CIRLOCK
CASELOCK
functionCLIPAPP
num = CLIPAPP(text)
CLIPGET
str = CLIPGET(line)
CLIPLINE
num = CLIPLINE(dummy)
CLIPSET
num = CLIPSET(text)
CNT
num = CNT(X1 , X,..... , Xn)
CNTX
num = CNTX(X1 , X,..... , Xn)
CNTR
num = CNTR( X )
PROCESS REC
or PROCESS ROWS
loop that are not missing or undefined. Returns zero if all values are missing or undefined.CNTRX
num = CNTRX( X )
PROCESS REC
or PROCESS ROWS
loop that are not undefined. Returns zero if all values are undefined. The count includes values defined as excluded.COLCOUNT
num = COLCOUNT (conid,statid)
COLLABEL
str = COLLABEL (conid,statid,colno)
COLLEN
num = COLLEN (conid,statid,colno)
COLNAME
str = COLNAME (conid,statid,colno)
COLTYPE
num = COLTYPE (conid,statid,colno)
1 = String
2 = Timestamp string
3 = Date
4 = Time
5 = Integer
6 = R4
7 = R8
8 = Scaled Integer
YYYYMMDDHHMMSStttt where YYYY is the year, MM is the month, DD is the day number, HH is the 24 hour number, MM is the minutes, SS is the seconds and tttt is the thousandths of a
second. Any of these components may be zero.COLVALN
num = COLVALN (conid,statid,rowno,colno)
COLTYPE
. e.g. Integers can be assigned to a real.COLVALS
str = COLVALS (conid,statid,rowno,colno)
COMMA
str = COMMA( str )
COMMA ('4500000')
returns '4,500,000'.COS
num = COS( X )
CPYFILE
num = CPYFILE (oldname_str,newname_str)
CRYPTKEY
num = CRYPTKEY(encryption_key)
ENCRYPT/DECRYPT
. The key is a 256 bit (32 character) string. The key only needs to be set once in a session that uses the encryption functions.
If the key is not set, the encryption functions use a key of all blanks.COUNT
num = COUNT( X )
CTIME
num = CTIME(X , time format)
Specify a time string X and a time format. See time formats for a complete description. If the hour, minute or second field is omitted, they default to zero. For example:WINTIME = CTIME('18:36:45', 'HH:MM:SS')
CURDIR
str = CURDIR( 0 )
CURREC
num = CURREC( 0 )
PROCESS RECORD
or
PROCESS DATA
or JOURNAL IS
block.DATEC
str = DATEC(X , date format)
DATEC(XBEG, 'Www, Mmm DDth, YYYY')
produces a
result such as "Thu, May 25th, 2015DATEMAP
str = DATEMAP (rtnum, varname_exp)
The varname is an expression. If this is a constant, enclose the name in quotes. Undefined is returned if the variable is unknown or is not a date variable. For example, if the variable BIRTHDAY
in record type one has the date format MM DD YY
in the schema, then MM DD YY
is returned.DATESTR = DATEMAP (1, 'BIRTHDAY')
DBINDN
str = DBINDN (index)
DBINDR
n = DBINDR (index)
DBINDS
n = DBINDS (dummy)
DBINDT
str = DBINDT (index,varno)
DBINDU
n = DBINDU (index)
DBINDV
n = DBINDV (index)
DBATTR
str = DBATTR (n)
SYSnnnn1
which corresponds to the attribute of the .SR1
file for the database; the attributes for the various database files .SR1 - .SR6
have corresponding different final digits 1 - 6 and the prefix attribute has a final digit of 8.DBNAME
str = DBNAME (n)
SYSTEM(40)
returns the size of the connected databases table. Zero returns the name of the default database.DBNUM
nth = DBNUM (name)
DBNO
is a synonym.DBPRE
str = DBPRE (n)
DSN
function for the prefix attribute for the database (SYSnnnn8
) or for the PREFIX
attribute for the default database.DBTYPE
num = DBTYPE (dummy)
DECRYPT
str = DECRYPT(string,length)
CRYPTKEY
) prior to the first invocation of this function. Obviously the key must be the same as was used to encrypt the string.DEFFAM
str = DEFFAM(0)
DEFMEM
str = DEFMEM(0)
DEFTFN
str = DEFTFN(0)
DELDIR
n = DELDIR(dir_name)
DELFILE
n = DELFILE(file_name)
DELMCLID
str = DELMCLID(id,password)
GETMCLID
. Specify a password as a string variable or string in quotes if the Master is started with a password.DGLOBAL
num = DGLOBAL(string_exp)
DITEM
DITEM...
DITEM
series of functions all pertain to the Dialog Editor used to construct screen painting applications.DITEMCOL
num = DITEMCOL(n)
Returns the column the nth DEDIT
item is positioned at.DITEMH
num = DITEMH(n)
Returns the height of the nth DEDIT
item.DITEMID
num = DITEMID(n)
Returns the id of the nth DEDIT
item.DITEMROW
num = DITEMROW(n)
Returns the row the nth DEDIT item is positioned at.DITEMS
num = DITEMS(0)
Returns the number of items on DEDIT
dialog.DITEMSEL
num = DITEMSEL(0)
Returns the number of items selected on DEDIT
dialog.DITEMSID
num = DITEMSID(n)
Returns the id of the nth selected DEDIT
item.DITEMTXT
str = DITEMTXT(n)
Returns the text of the nth DEDIT
item.DITEMTYP
num = DITEMTYP(n)
Returns the type of control of the nth DEDIT
item.DITEMW
num = DITEMW(n)
Returns the width of the nth DEDIT
item.DSN
str = DSN( string_exp )
DTTOTS
real*8 = DTTOTS (date,time)
TSTODT
and TSTOTM
functions before using any other date and time functions.EDIT
output_str = EDIT( input_str,edit_str )
PROGRAM
SSN = EDIT('123456789','^^^-^^-^^^^')
WRITE SSN
END PROGRAM
Output: 123-45-6789
EDITNAME
str = EDITNAME(0)
ENCRYPT
str = ENCRYPT(string,length)
CRYPTKEY
) prior to the first invocation of this function.
The input is a SIR/XS string as is the output encrypted version but it should be noted that encryption may result in non-text characters and so encrypted strings should not be written to text files.
The encryption algorithm encrypts eight (8) characters at a time and any input string is padded with blanks so that the output is a correctly encrypted string. Do not truncate the output string; do not save an encrypted string that is not a multiple of eight as this will corrupt the decryption of the last few characters.ERROR
num = ERROR( strX )
EXISTS
num = EXISTS( X )
CNT
function.EXISTSX
num = EXISTSX( X )
CNTX
function.EXISTSR
num = EXISTSR( X )
PROCESS REC
or PROCESS ROWS
loop.EXISTSRX
num = EXISTSRX( X )
PROCESS REC
or PROCESS ROWS
loop.EXP
num = EXP( X )
EXTERN
num = EXTERN ( X )
EXTERN
dll. The function can take a numeric or string parameter and calls a different user function for each case. The extern.dll
library supplied by SIR contains dummy functions which return zero.EXTERNS
str = EXTERNS ( X )
EXTERN
dll. The function can take a numeric or string parameter and calls a different user function for each case. The extern.dll
library supplied by SIR contains dummy functions which return blank (a zero length string).FAMNAME
str = FAMNAME(n)
SYSTEM(57)
= Count of families). FEQ
str = FEQ(real1,real2,exponent)
FILECNT
n = FILECNT(str)
FILEIN
str = FILEIN(filter,default_extension)
FILEIS
n = FILEIS(file_name_string)
FILEN
str = FILEN(string,n)
FOR N = 1,FILECNT("*.pql")
. WRITE [FILEN("*.pql",N)
END FOR
FILEOUT
str = FILEOUT(filter,default_extension)
FILESTAT
n = FILESTAT(filename_string,type_of_data)
Type of data
1 gid Numeric identifier of group that owns file (UNIX-specific)
2 st_atime Time of last access of file. (system date/time integer)
3 st_ctime Time of creation of file. (system date/time integer)
4 st_dev Drive number of the disk containing the file (same as st_rdev).
5 st_ino Number of the information node (the inode) for the file (UNIX-specific).
6 st_mode Bit mask for file-mode information. The _S_IFDIR bit is set if path specifies a directory; the _S_IFREG bit is set if path specifies an ordinary file or a device. User read/write bits are set according to the file's permission mode; user execute bits are set according to the filename extension.
7 st_mtime Time of last modification of file. (system date/time integer)
8 st_nlink Always 1 on non-NTFS file systems.
9 st_rdev Drive number of the disk containing the file (same as st_dev).
10 st_size Size of the file in bytes; (Can exceed I4 in size)
11 uid Numeric identifier of user who owns file (UNIX-specific)FILETIME
n = FILETIME(filename_string,type_of_data)
Type of data
1 Time of last access of file.
2 Date of last access of file.
3 Time of creation of file.
4 Date of creation of file.
5 Time of last modification of file.
6 Date of last modification of file.FILL
str = FILL(strX , strY)
RESULT = FILL (' $100.00', '*')
returns "**$100.00"
FINDITEM
num = FINDITEM (id,pos,txt)
FORMAT
str = FORMAT( X [,W [,D ]] )
FORMAT( X )
returns free-field format as wide as necessary to fit the value. FORMAT(X,W)
returns a free field format of width W. FORMAT(X,W,D)
returns a number with D decimal places in width W. X, W and D, can be variables, constants or expressions. W, if specified, must be greater than or equal to zero. D, if specified, can be -1 or greater than or equal to zero. -1 is equivalent to not specifying a value (free field format). If D is specified, W must be greater than D. For example:
STR = FORMAT (1.3) returns '1.3'
STR = FORMAT (1.3, 4) returns ' 1.3'
STR = FORMAT (1.3, 5, 2) returns ' 1.30'
FST
num|str = FST( X1, X.., Xn )
FSTR
num|str = FSTR( X )
PROCESS REC
or PROCESS ROWS
loop that is not missing or undefined.GETBTNH
num = GETBTNH (dummy)
GETCHCH
num = GETCHCH (dummy)
GETCHKH
num = GETCHKH (dummy)
GETAKL
n = GETAKL(0)
GETDFC
n = GETDFC(0)
GETENV
str = GETENV(variable_str)
COMPUTE OSPATH = GETENV('PATH')
GETERR
str = GETERR (dummy)
GETFLT
dbl = GETFLT (id)
GETTXT
. Returns 0.0 if not f.p. number.GETFOCUS
num = GETFOCUS (0)
GETICHK
num = GETICHK (id)
GETIFLT
dbl = GETIFLT (id,pos)
GETIINT
int = GETIINT (id,pos)
GETINT
int = GETINT (id)
GETTXT
. 0 if not integer.GETITXT
str = GETITXT (id,pos)
GETLBLH
num = GETLBLH (dummy)
GETLTXT
str = GETLTXT (id,p)
GETMAXCH
num = GETMAXCH (dummy)
GETMCADD
str = GETMCADD (id)
GETMCHK
num = GETMCHK (id)
GETMCLID
n = GETMCLID (n)
GETMCLST
n = GETMCLST (n)
GETMCON
n = GETMCON (n)
GETMDBN
str = GETMDBN (n)
GETMSEL
num = GETMSEL (id,N)
GETMSEL(id,1)
is the same as GETPOS(id)
.GETNITEM
num = GETNITEM (id)
GETNLINE
num = GETNLINE (id)
GETNSEL
num = GETNSEL (id)
GETPOS
num = GETPOS (id)
GETRADH
num = GETRADH (dummy)
GETRSTEP
num = GETRSTEP (dummy)
GETTXT
str = GETTXT (id)
GETTXTH
num = GETTXTH (dummy)
GLOBALN
num = GLOBALN(globvar_exp , numeric_exp)
COMPUTE Y = GLOBALN('RT', 25.5)
GLOBALS
num = GLOBALS(stringexp , stringexp)
TEMP
the value JOE SMITH
:COMPUTE Y = GLOBALS ('TEMP','JOE SMITH')
GLOBALN
and GLOBALS
return:
0 if the assignment was made.
-1 if the first argument is not a valid global variable name.
-2 if the second argument is missing.GLOBALN
or GLOBALS
for text substitution in the same program (by using the global variable name within angle brackets) because the functions work at execution time and text substitution happens at compile time.GLOBNAME
str = GLOBNAME(n)
SYSTEM(53)
= Global Count).
HASH
hashed_string = HASH(source_string, type)
HASH
function generates a 32 byte encrypted string that is not intended to be decrypted but can be used to check values by re-hashing those values and comparing the result to the previously hashed string.
The function can be used in one of two ways. It can be used to hash a single string (up to the maximum SIR/XS string size).
To do this, specify a type of zero 0.
For example:COMPUTE HASHSTRING = HASH (PASSWORD,0)
COMPUTE HASHSTRING = HASH (sourcestring,1)
PROCESS RECORD ......
. COMPUTE HASHSTRING = HASH (NAME,2)
END PROCESS RECORD
COMPUTE HASHSTRING = HASH (sourcestring,3)
HELP
error = HELP( help page )
.htm
.
For example:COMPUTE X = HELP ('visualpql/function/foreword')
HEXCHAR
str = HEXCHAR(hexstr)
CHARHEX
COMPUTE STR = HEXCHAR("48656C6C6F20576F726C64")
returns Hello World
ICHAR
num = ICHAR(C)
IDSTATUS
num = IDSTATUS(id)
JOUFLAG
num = JOUFLAG (dummy)
JULC
str = JULC( X )
MMM DD, YYYY
.JULN
num = JULN(month,day,year)
For example:CENTYR
parameter is used to determine the appropriate century to use.
DURATION = JULN(4, 8, 0) - BEGINDAT
ENDPROJ = JUNL(TMON, TDAY, TYEAR)KEYNAME
str = KEYNAME (rtnum, keynum)
RTNUM
is the record number. KEYNUM
is the number of the keyfield, i.e. 1 is the case id, 2 is the first key field in the record type, etc.KEYORDER
str = KEYORDER (rtnum, varname_string)
LEN
num = LEN( strX )
LG10
num = L10( X )
ALOG10
function.LINES
num = LINES(filename)
LN
num = LN( X )
ALOG
function.LOG
num = LOG( X )
ALOG
function.LOG10
num = LOG10( X )
ALOG10
function. (LG10
is also allowed.)LOWER
str = LOWER( string )
LST
num|str = LST(X1 , X ,....., Xn)
LSTR
num|str = LSTR( X )
PROCESS
REC
or PROCESS ROWS
loop that is not missing or undefined.MAKEDIR
num = MAKEDIR(name)
MAX
num|str = MAX(X1 , X ,....., Xn)
MAXR
num|str = MAXR( varname )
PROCESS REC
or PROCESS ROWS
loop that is not missing or undefined.MAXRECS
num = MAXRECS( rectype )
MEAN
num = MEAN(X1 , X ,....., Xn)
MEANR
num = MEANR( varname )
PROCESS REC
or PROCESS ROWS
loop that are not missing or undefined.MEMCOUNT
num = MEMCOUNT(famname)
MEMINFO
num = MEMINFO(member_name,infotype)
type
of the member(s). Returns 1 for :T; 2 for :E; 4 for :O ; 8 for :V
If the member type is not specified as part of the member name, and there is more than one version,
then the sum of the types is returned. e.g. There are two versions of SYSPROC.MENU.ABOUT
, a text version (:T) and a compiled subroutine version(:O) so:
MEMINFO ("SYSPROC.MENU.ABOUT",1)
returns 5
MEMINFO ("SYSPROC.MENU.ABOUT:O",1)
returns 4
MEMINFO ("SYSPROC.MENU.ABOUT:E",1)
returns missing.
0 - Good
-1 Mismatched version of SIR/XS
-2 Default database not connected
-3 Mismatched Database creation date/time
-4 Mismatched VisualPQL version
-5 Mismatched CIR/Record Schema level
MEMNAME
str = MEMNAME(famname,n)
MIN
num|str = MIN(X1 , X ,..., Xn)
MINR
num|str = MINR( varname )
PROCESS REC
or PROCESS ROWS
loop that is not missing or undefined.MISNUM
num = MISNUM( X )
MISS
str = MISS (rtnum, varname_str , n)
MISSING
num|str = MISSING(varname)
PROGRAM
INTEGER*2 MYVAR
EXCLUDED VALUES MYVAR (98,99)
COMPUTE X = MISSING(MYVAR)
COMPUTE Y = MISNUM (MYVAR)
COMPUTE Z = MISS(-1,'MYVAR',Y)
WRITE 'UNDEFINED ' X Y Z
COMPUTE MYVAR = 99
COMPUTE X = MISSING(MYVAR)
COMPUTE Y = MISNUM (MYVAR)
COMPUTE Z = MISS(-1,'MYVAR',Y)
WRITE '99 EXCLUDED 2 ' X Y Z
COMPUTE MYVAR = 10
COMPUTE X = MISSING(MYVAR)
COMPUTE Y = MISNUM (MYVAR)
COMPUTE Z = MISS(-1,'MYVAR',Y)
WRITE '10 VALID ' X Y Z
END PROGRAM
writes
Undefined * 0 *
99 Excluded 2 99 2 99
10 Valid * * *
MKEYSIZE
num = MKEYSIZE ( dummy )
MAX KEY SIZE
for more information about maximum key size.
See MOD
AMOD
function.MRECSIZE
num = MRECSIZE (dummy)
MSGTXT
str = MSGTXT (num)
num
.NARG
num = NARG( position )
NARG
and SARG
functions.NARG
returns a numeric value from the command parameter list. The position is the position of the required parameter in the list. A position of zero returns the number of parameters in the list. (Use SARG
to retrieve string parameters.)
If the position is greater than the number of parameters in the list or the parameter value is not a number, undefined is returned. For example:
CALL * (1,ABC)
PROGRAM
INTEGER*4 P1
STRING*32 SP1
COMPUTE I = NARG(0)
FOR J = 1,I
. COMPUTE P1 = NARG(J)
. COMPUTE SP1 = SARG(J)
. WRITE P1 SP1
ROF
END PROGRAM
writes
1 1
* ABC
NBRANCH
num = NBRANCH (control_id,node)
NEXISTS
num = NEXISTS (var)
NEXTROW
num = NEXTROW (conid,statid)
NGET
num = NGET( varname_str )
NGLOBAL
num = NGLOBAL( name_string )
GLOBALN
to create and set numeric values for global variables. Use SGLOBAL
to return values from string global variables.) Note: Global Variables have no intrinsic type. The different string/numeric functions can refer to the same global variable - the difference is in the value. For example,
COMPUTE N = GLOBALS('MYGLOBAL','123')
COMPUTE N = NGLOBAL ('MYGLOBAL')
WRITE N
writes
123
NKEYS
num = NKEYS ( rtnum )
NLABELS
num = NLABELS ( rtnum , varname_str )
NVALLAB
.NMAX
num = NMAX ( rtnum , varname_str )
See VAR RANGES
for more information about valid ranges.NMIN
num = NMIN (rtnum, varname_str)
See VAR RANGES
for more information about valid ranges.NOFCASES
num = NOFCASES ( dummy )
N of CASES
for more information.NOW
num = NOW( dummy )
NPUT
num = NPUT ( A , Y )
COMPUTE DUMMY = NPUT('HEIGHT', 175)
NREAD
num = NREAD( strX )
NRECS
num = NRECS ( dummy )
NSUBDIR
str = NSUBDIR (n)
NUMBR
num = NUMBR( strX )
NUMBRC
num = NUMBRC( strX )
undefined if undefined
-1 if not a valid number string
0 if number is blank
If the string translates correctly to a real*8, it is then assigned to more restrictive formats starting with Integer*1. If the most restrictive format tests equal to the real*8, then the return value is set to to that.
1 Valid integer that could be stored in an Integer*1 variable
2 Valid integer that could be stored in an Integer*2 variable
4 Valid integer that could be stored in an Integer*4 variable
8 Valid floating point number that could be stored accurately in a REAL*4 variable
16 Valid floating point number that could only be stored in a REAL*8 numberNUMCASES
num = NUMCASES ( dummy )
SYSTEM(24)
or NUMRECS(0)
.NUMRECS
num = NUMRECS ( rtnum )
NVALID
num = NVALID ( rtnum , varname_str )
NVALLAB
num = NVALLAB ( rtnum , varname_str )
NLABELS
is a synonym. If the record number (rtnum) is negative, the function applies to a summary variable; if rtnum is one more than the maximum record count (i.e. NRECS(0)+1) then this applies to a standard variable.
See VALUE LABELS
for more information about value labels.NVARDOC
num = NVARDOC ( rtnum , varname_str )
VAR DOC
for more information about variable documentation.NVARS
num = NVARS ( rtnum )
NVARSC
num = NVARSC ( rtnum )
NVVAL
num = NVVAL ( rtnum , varname_str , n )
ODBCCOLS
num = ODBCCOLS (conid,statid,tabname)