|
Class Reference
%SYSTEM.Util
|
|
![]() |
|||
Private Storage |
The %SYSTEM.Util class provides an interface for managing
Caché utility functions.
You can use it via the special $SYSTEM object:
You can call help to get a list of all entrypoints:
Do $SYSTEM.Util.Help()
|
|
|
Returns the location of the binaries directory, where executables, DLL's, shared libraries, scripts, etc are kept.
Check if this job could be blocked by the specific switch represented by 'SwitchNumber'.
Returns 1 if the job could pass this check (not blocked), returns 0 if this job will be blocked.
For switch 10 and 11, if the job could not pass this test it also returns the PID of the job who set this switch in the '0,PID' format.
Performs collation conversion.Parameters
String : An expression specifying a string or number to be converted to a specified collation type.
flag : An integer code used to specify the desired collation type. Valid values are 0 through 9.
len : Optional -- The truncation length in characters, specified as an integer. Truncation is performed on the collation-converted string. This option can only be used with flag values of 7, 8, or 9. A decimal len value is truncated to its integer part. A negative or nonnumeric len value is treated as 0.Description
Collation applies the collation type specified in flag to string. The following flag values are supported:
0 - EXACT : Returns string unchanged. Does not convert NULLs. Corresponds to the Cache SQL %EXACT function.1 - SPACE : Appends a blank to beginning of string.
2 - MVR : Returns its argument converted to the MultiValue collation sequence. It is used when a string contains both numeric and non-numeric characters. It divides the expression string into substrings, each substring containing either all numeric or all non-numeric characters. The numeric substrings are sorted in signed numeric order. The non-numeric substrings are sorted in case-sensitive ASCII collation sequence.
3 - PLUS : Converts numerics and numeric strings to canonical numbers. A nonnumeric string is returned as 0.
4 - MINUS : Converts numerics and numeric strings to canonical numbers and prepends a minus sign. A nonnumeric string is returned as 0.
5 - UPPER : Converts letters to uppercase. Corresponds to the Cache SQL %UPPER function.
6 - ALPHAUP : Removes leading, trailing, and embedded blanks. Removes all punctuation characters, except commas (,) and question marks (?). Converts letters to uppercase. Corresponds to the Cache SQL %ALPHAUP function.
7 - SQLUPPER : Removes trailing blanks. Converts letters to uppercase. Appends a blank to beginning of string. Corresponds to the Cache SQL %SQLUPPER function.
8 - SQLSTRING : Removes trailing blanks. Appends a blank to beginning of string. Corresponds to the Cache SQL %SQLSTRING function.
9 - STRING : Removes leading, trailing, and embedded blanks. Removes all punctuation characters, except commas (,). Converts letters to uppercase. Appends a blank to beginning of string. Corresponds to the Cache SQL %STRING function.
Several of these collation conversions append a blank to the string. This forces numerics and the empty string to be collated as strings.
Numerics are converted to canonical form: leading and trailing zeros are removed, as is a trailing decimal point. Multiple plus and minus signs are resolved; if the resulting sign is a plus sign, it is removed.
The MINUS collation type appends a minus sign to the supplied sign before canonical resolution. Thus the MINUS collation of a negative number is a positive number. PLUS and MINUS resolve mixed numeric strings (such as "7dwarves") by truncating the string at the first nonnumeric character. PLUS and MINUS resolve nonnumeric strings by assigning them a value of 0.
Returns the compressed form of a given string.
A Cache compressed string is a ZLIB compressed data block (as defined in RFC 1950) with a Cache-proprietary wrapper. UseDecompress to decompress it.
Creates and returns a globally unique identifier.
A GUID is a 16 byte (128 bit) globally unique identifier.
Returns the original form of a Cache compressed string (seeCompress ).
Returns the value of an environment variable.
Returns MajorVersion.MinorVersion.BuildNumber on Windows.
Returns an unimplemented error on Unix or VMS.
Returns the priority of the current process or another process.
Returns the session Id on Windows.
If arg = 0 or no argument, returns the physical console Session Id or 0xffffffff if there is no session attached to the physical console. The physical console is the monitor, keyboard, and mouse.
If arg = 1, returns the session Id of the current process. On error, returns -GetLastError().
Returns an unimplemented error on Unix or VMS.
Returns the value of one system switch, or the values of all switches.
When the SwitchNumber is not specified,GetSwitch returns one value containing the state of all system switches.
Each system switch is represented by a bit in this value, with switch 0 as the least significant bit and switch 31 as the most signficicant.
For example:
Switch 0 -> 1
Switch 1 -> 2
Switch 2 -> 4
...
Switch 31 -> 0x80000000
When the SwitchNumber is specified (0 to 31),GetSwitch returns the state of the specific switch represented by SwitchNumber.
The return value is 1 if this switch is set, or 0 if it is cleared.
For switch 10 and 11, it also returns the PID of the job that set this switch in the '1,PID' format.
Switch Definitions -
Switches 0 to 7 are not used by the system and are reserved for the user.
Switch 8 (0x100) : Inhibits responding to network request for DCP, DDP and DTM. It does not block ECP traffic.
Switch 9 (0x200) : Inhibits new network signons, this only apply for DCP.
Switch 10(0x400) : Inhibits all global and lock access except by the job setting this switch.
Switch 11(0x800) : Inhibits all global and lock access except by the job setting this switch. This overrides switch 10 and is reserved for use by the system (should only be set by the system).
Switch 12(0x1000) : Inhibits new users to signon the system.
Switch 13(0x2000) : Inhibits sets, kills, and zsaves.
Switch 14(0x4000) : Inhibits access to globals and routines.
Switch 15(0x8000) : Allow network references from peers, even if switch 10,13, or 14 would normally prevent the access.
Switch 16(0x10000) : Used in ^SHUTDOWN only.
Switch 17(0x20000) : Used internally by system to skip waiting in journal synch.
Switch 18(0x40000) : Used internally by system to disable pausing processes in gblkrd() if the queue for a block gets too long.
Switch 19(0x80000) : Inhibits TSTART.
Returns a list of the number of global buffers for each buffer size.
Returns the location of the installation directory, i.e. that which is displayed by ccontrol on Unix and VMS, where the .cpf configuration file is kept.
Determines whether $HOROLOG includes a daylight saving time adjustment.
TimeStamp is a UTC time stamp value (same format as $ZTIMESTAMP). IfTimeStamp is not specified, the current time is used with $HOROLOG adjusted by the $ZTIMEZONE special variable.The return value reports whether the corresponding $HOROLOG time is adjusted by an additional DST hour.
Changes to $ZTIMEZONE will change the value of $HOROLOG but the time zone rules do not change. The time zone rules are always those used by the operating system on which the Cache process is running. The time zone rules of the Cache process will be applied to the local time.
The UTC time stamp is converted to a time_t value (taking into account adjustments to $ztimezone) which is then used as input to call the C Programming Language standard library routine localtime(). The tm_isdst element of the returned tm struct is examined to determine if the daylight savings time is in effect.
Return Values:
0 - DST is not in effect.
1 - DST is in effect.
-1 - It cannot be determined if DST is in effect.
Sets the system-wide job priority delta to the specified number.
The priority of any jobbed process on the system = priority of parent + system job priority.
The new jobprio value is returned
Converts Local time to UTC time.Parameter
h : A string representing Local time in the same format as that returned by $HOROLOG.Return Value
A string representing the corresponding UTC time in the same format as that returned by $ZTIMESTAMP.
Note: This method only supports dates between December 31, 1969 and January 18, 2038. Dates outside this range will give an <ILLEGAL VALUE> error.
Note: $ZTIMEZONE Warning
This method is unusual in that it adjusts the Local time by any changes made to the $ZTIMEZONE special variable. Use of the $ZTIMEZONE variable is limited to a few special situations. $ZTIMEZONE affects the value returned by $HOROLOG but most other date/time features and functions (including $ZDATETIME and $ZDATETIMEH) ignore $ZTIMEZONE changes. Even though changing $ZTIMEZONE will change the value returned by $HOROLOG, the time zone rules do not change. The time zone rules are always those used by the operating system on which the process is running. The $ZTIMEZONE special variable will probably become a legacy feature in future versions of the system. If possible, applications should avoid changing $ZTIMEZONE and should use $ZDATETIME(h,-3) to convert Local time to UTC time.
Returns the location of the manager directory, where the CACHESYS database and runtime files are kept.
Returns the number of CPUs on the system.
Purges existing error report records from SYSLOG.
Returns the largest routine buffer size that been configured.
Sets the calling process, or the one identified bypid , to be a batch process.
A batch process yields its turn to non-batch processes.
For example, if multiple processes are waiting for access to global buffers, non-batch processes have priority over batch processes.
flag - 1 - set to batch mode, 0 - set to non-batch mode
pid - pid to set to batch mode. Null argument sets calling process.
Returns the old value of the batch flag, or -1 if error
Adjusts the priority of the current process or another process up or down by delta amount.
The new priority is returned.
Sets the value of a system switch.
When one parameter is specified,SetSwitch(SwitchValue) sets the value of all system switches toSwitchValue .
It returns the original value of all switches.
This is not recommended to be used by users.
When two parameters are specified,SetSwitch(SwitchNumber,SwitchValue) sets the value of the specific switchSwitchNumber toSwitchValue .
It returns the original switch value.
To set switch 10 or (11 in cluster), if the switch was set then theSetSwitch won't do anything and the original value with the owner PID is returned in '1,PID' format..
To clear switch 10 or (11 in cluster), if the switch was cleared or was set by different process then theSetSwitch won't do anything and the original value is returned.
SeeGetSwitch for a definition of the switches.
Converts UTC time to Local time.Parameter
TimeStamp : A string representing a UTC time in the same format as that returned by $ZTIMESTAMP.Return Value
A string representing the corresponding Local time in the same format as that returned by $HOROLOG.
Note: This method only supports dates between January 1, 1970 and January 18, 2038. Dates outside this range will give an <ILLEGAL VALUE> error.
Note: $ZTIMEZONE Warning
This function is unusual in that it adjusts the Local time by any changes made to the $ZTIMEZONE special variable. Use of the $ZTIMEZONE variable is limited to a few special situations. $ZTIMEZONE affects the value returned by $HOROLOG but most other date/time features and functions (including $ZDATETIME and $ZDATETIMEH) ignore $ZTIMEZONE changes. Even though changing $ZTIMEZONE will change the value of returned by $HOROLOG, the time zone rules do not change. The time zone rules are always those used by the operating system on which the process is running. The $ZTIMEZONE special variable will probably become a legacy feature in future versions of the system. If possible, applications should avoid changing $ZTIMEZONE and should use $ZDATETIMEH(timestamp,-3) to convert UTC time to Local time.