Skip to main content

SYSTEM

Returns various system parameter values.

Synopsis

SYSTEM(code)

Arguments

code An expression that resolves to an integer code specifying which information to return.

Description

The SYSTEM function returns a variety of system parameters. The following table lists the code parameters. Those code numbers that are not listed are either not implemented or perform no operation and always return 0 or the empty string.

0 Always returns 0 for all emulations except D3, see below.
1 A boolean value that returns 1 if the printer is on. Otherwise, returns 0.
2 Returns the current page width, in characters, as defined by the terminal settings. If output is directed to the printer, it returns the width of the printer (for channel 0).
3 Returns the current page length (depth), in lines, as defined by the terminal settings. If output is directed to the printer, it returns the page length of the printer (for channel 0).
4 Returns the number of lines remaining on the current page, with the last line being line 1. If output is directed to the printer, it returns the printer/spooler values, dependent on the HEADING and FOOTING settings. The PRINTER RESET command resets this value.
5 Returns the current page number, as calculated for the HEADING or FOOTING statement. Note that the SYSTEM(5) value reflects when the function is invoked, not when its return value is printed; the page number value may be the previous page when this return value is printed as the first line of the next page. This parameter may be set using the ASSIGN command from the Caché MultiValue Shell.
6 Returns the current line number.
7 Returns the terminal type code. This parameter may be set using the ASSIGN command from the Caché MultiValue Shell. Refer to the Caché MultiValue CHOOSE.TERM command for further details on terminal types.
9 CPU msec used.
10 A boolean value that indicates whether the data stack is active. Returns 1 if input data is pending from a DATA statement. Otherwise, returns 0.
11 An integer value that indicates the number of items in the default select list. If no select list is active, returns 0. (For UniVerse, PICK, INFORMATION, PIOpen, and IN2 emulation, see below.) See @SELECTED system variable.
12 Returns the current system time in elapsed milliseconds since midnight (local time). This is the same local time returned by the TIME function, which returns the time in elapsed seconds and fractional seconds, rather than in milliseconds. Refer to TIME for details on how local time is determined.
13 Release timeslice.
14 A boolean value that returns 1 when there are unread characters in the input buffer. Returns 0 when there are no characters in the input buffer.
15 Returns the option codes from the end of a command line. For example, if you invoke a cataloged program as MYPROG (X,P the value returned by SYSTEM(15) is "XP". If you specify the command DATE.FORMAT (D), SYSTEM(15) returns "D".
16 A boolean value that indicates whether the current process is running from a proc. Returns 1 if running from a proc. Otherwise, returns 0.
17 STOP code for child process.
18 Returns the port number for the terminal. Refer to the LISTME command in Caché MultiValue Commands Reference.
19 Returns the current user's login name. (For D3 emulation, see below.)
20 Returns the spooler job number last created by this user. If a job is output to the &HOLD& file (printing mode 3) then the SYSTEM(20) value is not updated. The SYSTEM(20) value is only updated in printing mode 1 (printing to the ^SPOOL global).
22 Returns PERFORM / EXECUTE level. The default is 0. (For D3 emulation, see below.)
23 A boolean value that indicates whether the Break key is enabled. Returns 1 if it is enabled. Otherwise, returns 0. The default is enabled.
24 A boolean value that indicates whether the echoing of input characters is enabled. Returns 1 if it is enabled. Otherwise, returns 0. The default is enabled.
25 A boolean value that indicates whether the current process is running from a phantom process. Returns 1 if running from a phantom process. Otherwise, returns 0.
26 Returns the current user prompt character. The default is “?”.
27 On UNIX® systems, returns the uid (user ID). On other systems, returns 0.
28 On UNIX® systems, returns the effective user ID. On other systems, returns 0. (For D3 emulation, see below.)
29 On UNIX® systems, returns the gid (group ID). On other systems, returns 0. (Only supported in Caché and UniVerse.)
30 On UNIX® systems, returns the effective gid (group ID). On other systems, returns 0. (Only supported in Caché and UniVerse.)
31 Returns the Caché license order number for Caché and for IN2, INFORMATION, Pick, PIOpen, Prime, and UniVerse emulations. (For D3 emulation, see below.)
32 Returns the Caché system manager directory pathname. For example, c:\intersystems\cache\mgr\.
33 Returns the contents of the command stack (Caché, UniVerse, PICK emulations only). See @COMMAND.STACK system variable for further details. (For D3 and UniData emulations, see below.)
34 Returns data pending on the input stack. (Only supported in Caché and UniVerse.)
35 [Only supported in IN2, INFORMATION, PICK, PIOpen, Prime, and UniVerse emulations. See below.]
36 Returns the current licensed user count. Refer to the %SYSTEM.License.GetUserLimit()Opens in a new tab method in the InterSystems Class Reference.
40 For an MVBasic program, returns the current program name as file~program. For a terminal, returns the current MV shell identifier. For example MVBASIC420.mvi, where 420 is the process ID for the current terminal. (Supported for all emulations except D3; in D3 emulation use SYSTEM(157).)
41 Returns the Caché version number. This is the same as the value returned by the ObjectScript $ZVERSION special variable. (Supported for all emulations.)
43 Returns the port number of the process holding a lock requested by the current process. After a failed lock request, the STATUS function returns the process ID (pid) of the holder of the lock.
44 Returns 1 for a Caché MultiValue system, in any emulation except D3.
49 Returns the current call stack as a dynamic array. The top level is the current routine. The array format is: array<n,1> = the stack level, counting from 1; array<n,2> = the program name specified as file~program; array<n,3> = the source program line number that called the next level. array<n,3> returns 0 if the line cannot be determined; usually this occurs if the routine has been recompiled.
52 [Only supported in jBASE emulation. See below.]
91 A boolean value that indicates whether the operating system is Windows. Returns 1 if running on an operating system in the Windows NT family. Otherwise, returns 0.
99 Returns the POSIX-compliant current universal system time, specified as an integer number of elapsed seconds since midnight of January 1, 1970, in Greenwich Mean Time (GMT). Refer to the ObjectScript $ZDATETIME and $ZDATETIMEH functions in Caché ObjectScript Reference.
100

Returns Caché version information. The format is platform-dependent.

Windows: system-name;config-file-name:name;release;version;hardware-type;release-date;unused;unused;config-file-name;os-name;hardware/serialnum

UNIX®: system-name;os-name;config-file-name:name;release;version;hardware;monitor-version;boot-monitor-release-date;config-file-name;os-name;hardware/serialnum

For further details, see SYSTEM(100) in Operational Differences between MultiValue and Caché.

104 Returns the number of active MultiValue users, as reported by the LISTU command.
157 Same as SYSTEM(40). Supported in all emulations.
166 Same as SYSTEM(49). Supported in all emulations.
169 Returns the name of the computer.
255 Returns the operating system type. For example, “Windows NT”.
1001 Returns an emulation table number that specifies the emulation type that the program was compiled with (see below).
1002 Returns current Caché namespace
1005 Returns a boolean value for screen paging control.
1017 Returns the operating system name. For example, “Windows”.
1051 Returns an emulation table number that specifies the emulation type that the program was compiled with (see below).
1052 Returns the current Caché namespace.
1053 Returns the client IP address. For example, “127.0.0.1”
1054 Returns the Caché system manager directory pathname. For example, c:\intersystems\cache\mgr\. See SYSTEM(32).
1055 Returns the current namespace pathname. For example, c:\intersystems\cache\mgr\samples\.
1056 Returns a string of four emulation attributes, as follows: An integer code for the emulation in effect when the program was compiled; the name of the emulation type in effect when the program was compiled; an integer code for the current emulation for the MultiValue account; the name of the current emulation type for the MultiValue account.

You can use the ASSIGN statement to modify these system settings.

Emulation

SYSTEM(1001) and SYSTEM(1051) return the current emulation as an integer code, as follows: 0=Caché, 1=jBASE, 2=Reality, 3=UniVerse, 4=UniData, 5=PICK, 6=Ultimate, 7=Prime or INFORMATION, 8=PIOpen, 9=POWER95, 10=MVBase, 11=D3, 12=IN2, 13=R83, 14=UDPICK.

SYSTEM(16) returns the current stack level for all MultiValue emulations except Caché, and UniVerse emulation.

  • D3 emulation:

    • SYSTEM(0) returns 0 or a process ID indicating lock status. For example, following a failed lock request, it returns the process ID (pid) of the process holding a lock requested by the current process.

    • SYSTEM(11) after a READNEXT always returns 0, due to the PICK.SELECT behavior described in READNEXT.

    • SYSTEM(19) returns a unique ID value, composed of the date and time in Caché internal format (DDDDDSSSSS) and (if necessary) an incrementing two-character alpha suffix to ensure uniqueness.

    • SYSTEM(22) returns the port number of the current process.

    • SYSTEM(24) defaults to 0.

    • SYSTEM(30) returns the port number of the process holding a lock requested by the current process.

    • SYSTEM(31) returns the last form queue number (a number from 0 upwards, not the form queue name) that was last assigned with the SP.ASSIGN command.

    • SYSTEM(33) returns the call stack (a @VM-delimited stack of routine names) if the current routine is a subroutine; returns nothing if the current routine is a program. D3 also returns the standard SYSTEM(49) call stack.

    • SYSTEM(23), SYSTEM(25), SYSTEM(26), SYSTEM(27), SYSTEM(28), SYSTEM(29), SYSTEM(32), SYSTEM(34), SYSTEM(35), SYSTEM(40), SYSTEM(43), SYSTEM(44), and SYSTEM(52) are not supported in D3 emulation. Use SYSTEM(157) for SYSTEM(40) functionality.

  • jBASE emulation:

    • SYSTEM(14) in native jBASE checks for pending input from any source; Caché MultiValue users must change this to check both SYSTEM(14) and SYSTEM(10).

    • SYSTEM(52) returns the computer name.

    • SYSTEM(1001) returns the command line as an attribute-delimited string.

    • SYSTEM(29), SYSTEM(31), SYSTEM(32), SYSTEM(33), SYSTEM(34), and SYSTEM(35) are not supported in jBASE emulation.

  • UniData emulation:

    • SYSTEM(11) returns the SELECT count (the same as the @SELECTED value) when using Select List 0. For any other select list, only @SELECTED is set. Each invocation of READNEXT decrements this SYSTEM(11) count (but not the @SELECTED count).

    • SYSTEM(33) returns the current system platform.

    • SYSTEM(48) when called by a program being run by the PHANTOM command, SYSTEM(48) returns the name of the item in the &PH& file that is receiving program output.

    • SYSTEM(29), SYSTEM(31), SYSTEM(32), SYSTEM(34), SYSTEM(35), and SYSTEM(52) are not supported in UniData emulation.

  • UniVerse emulation. Unless otherwise specified, references to UniVerse emulation also apply to PICK, Prime, INFORMATION, PIOpen, and IN2:

    • SYSTEM(11) returns a boolean value that indicates whether the default select list is active.

    • SYSTEM(29) is supported in UniVerse emulation, but is not supported in other emulation modes.

    • SYSTEM(34) is supported in UniVerse emulation, but is not supported in other emulation modes.

    • SYSTEM(35) returns the number of active MultiValue users, as reported by the LISTU command line command.

    • SYSTEM(40) returns the current namespace pathname.

    • SYSTEM(52) is not supported in UniVerse emulation.

See Also

FeedbackOpens in a new tab