SYSTEM Functions

The following system functions are supported in jBASE 4 and jBASE 5 (for the jBASE 3 system functions go here):

SYSTEM(0) Return the last error code
SYSTEM(1) Return 1 if output directed to printer
SYSTEM(2) Return page width
SYSTEM(3) Return page depth
SYSTEM(4) Return no of lines to print in current page. (HEADING statement)
SYSTEM(5) Return current page number (HEADING statement)
SYSTEM(6) Return current line number (HEADING statement)
SYSTEM(7) Return terminal type
SYSTEM(8) Return record length for tape channel 0
SYSTEM(9) Return CPU milliseconds
SYSTEM(10) Return 1 if stacked input available
SYSTEM(11) Returns the number of items in an active select list or 0 if no list is active
SYSTEM(12) Return 1/1000, ( or 1/10 for ROS), seconds past midnight
SYSTEM(13) Release time slice
SYSTEM(14) Return the number of characters available in input buffer. Invoking SYSTEM(14) can cause in a slight delay in program execution.
SYSTEM(15) Return bracket options used to invoke command
SYSTEM(16) Return current PERFORM/EXECUTE level
SYSTEM(17) Return stop code of child process
SYSTEM(18) Return port number or JBCPORTNO
SYSTEM(19) Return login name or JBCLOGNAME. If the system_19_timedate emulation option is set, then the number of seconds since midnight December 31, 1967 is returned.
SYSTEM(20) Return last spooler file number created
SYSTEM(21) Return port number or JBCPORTNO
SYSTEM(22) Reserved
SYSTEM(23)
Return status of the break key
Enabled
0 Enabled
1 Disabled by BASIC
2 Disabled by Command
3 Disabled by Command and BASIC
SYSTEM(24) Return 1 if echo enabled, 0 if echo disabled
SYSTEM(25) Return 1 if background process
SYSTEM(26) Return current prompt character(s) (use SYSTEM(2092) with D3 emulation)
SYSTEM(27) Return 1 if executed by PROC
SYSTEM(28)
Return status of Case Sensitivity
0 Case Insensitive
1 Case Sensitive
SYSTEM(29) Reserved.
SYSTEM(30) Return 1 if paging is in effect (HEADING statement)
SYSTEM(31) Reserved
SYSTEM(32) Reserved
SYSTEM(33) Reserved
SYSTEM(34) Reserved
SYSTEM(35) Return language in use as a name or number (ROS)
SYSTEM(36) Reserved
SYSTEM(37) Return thousands separator
SYSTEM(38) Return decimal separator
SYSTEM(39) Return money symbol
SYSTEM(40) Return program name
SYSTEM(41) Return release number
SYSTEM(42) Reserved
SYSTEM(43) Return port number of item lock
SYSTEM(44) Return 99 for jBASE system type
SYSTEM(45) Reserved
SYSTEM(46) Reserved
SYSTEM(47) Return 1 if currently in a transaction
SYSTEM(48) Reserved
SYSTEM(49) Return PLID environment variable
SYSTEM(50) Return login user id
SYSTEM(51) Reserved
SYSTEM(52) Return system node name
SYSTEM(53) Reserved
SYSTEM(100) Return program create information
SYSTEM(101) Return port number or JBCPORTNO
SYSTEM(102) Reserved
SYSTEM(1000) Return command line separated by attribute marks
SYSTEM(1001) Return command line and options
SYSTEM(1002) Return temporary scratch file name
SYSTEM(1003) Return terminfo Binary definitions
SYSTEM(1004) Return terminfo Integer definitions
SYSTEM(1005) Return terminfo String definitions
SYSTEM(1006) Reserved
SYSTEM(1007) Return system time
SYSTEM(1008) Return SYSTEM file path
SYSTEM(1009) Return MD file path
SYSTEM(1010) Return Print Report information
SYSTEM(1011) Return jBASE release directory path. JBCRELEASEDIR
SYSTEM(1012) Return jBASE global directory path. JBCGLOBALDIR
SYSTEM(1013)
Return memory usage (UNIX only):
<1> Free memory small blocks
<2> Free memory large blocks
<3> Used memory small blocks
<4> Used memory large blocks
SYSTEM(1014) Return relative PROC level
SYSTEM(1015) Return effective user name. LOGNAME
SYSTEM(1016) Return tape assignment information
SYSTEM(1017) Return platform. UNIX, WINNT or WIN95
SYSTEM(1018) Return configured processors
SYSTEM(1019) Return system information (uname -a)
SYSTEM(1020) Return login user name
SYSTEM(1021) jBASE release information:
<1> Major release number
<2> Minor release number
<3> Patch level
<4> Copyright information
SYSTEM(1022) Returns the status of jBASE profiling:
0 no profiling is active
1 full profiling is active
2 short profiling is active
3 jCOVER profiling is active
SYSTEM(1023) Used by STATUS() function.
SYSTEM(1024) Retrieves details about last signals.
SYSTEM(1025) Returns value of International Mode (i.e. the JBASE_I18N environment variable) for the Thread
SYSTEM(1026) Total amount of memory in use, formatted with commas.
SYSTEM(1027)

Returns directory PROC; Used by WHERE, LISTU. Information about running processes can be obtained via the PROC jedi. This JEDI enables retrieval of information from executing processes and is the interface now used by the WHERE command.

 

OPEN SYSTEM(1027) TO PROC ELSE STOP 201, "PROC"

SELECT PROC TO Sel

LOOP

  READNEXT key FROM Sel ELSE EXIT

  READ ProcessRecord FROM PROC, key THEN

    * See the Attribute Description for ProcessRecord below

  END

REPEAT

 

Note: Info for the current user can be returned from the @USERSTATS variable.

 

Attribute Description for Process Records returned from the PROC Jedi READ interface:

<1> Port number (this is also the 'record key' of the process record)

<2> Number of programs running

<3> Connect time

<4> Process ID

<5> Account name

<6> User name

<7> Terminal name in jBASE format

<8> Terminal name in UNIX format

<9> Database name

<10> Name of the tty device

<11> Language name

<12> Time listening thread executed

<13> Mallinfo memory free

<14> Mallinfo memory used

<15>Type of thread as a number

<16> Type of thread as a string WHERE

  thread_type_string = "Normal" =1

  thread_type_string = "javaOBjEX" = 2

  thread_type_string = "vbOBjEX" = 3

  thread_type_string = "jrfs" = 4

  thread_type_string = "Compiler" = 5

<17> Number of instructions executed and licenses allocated

<18> Number of OPEN's

<19> Number of READ's

<20> Number of WRITE's

<21> Number of DELETE's

<22> Number of CLEARFILE's

<23> Number of EXECUTE's

<24> Number of INPUT's

<25> UNUSED

<26> Number of files the application thinks is open

<27> Number of files that are actually opened by the OS

<28> Application data set by @USER.ROOT

<29> Text String to identify process

<41> Command line arguments < threadnext >

<42> Current Line Number < threadnext >

<43> Name of source <threadnext >

<44> Status as a text string < threadnext >

  status = "Program running normally"

  status = "Program is SLEEPING"

  status = "Program in DEBUGGER"

  status = "Program at keyboard INPUT"

  status = "Program blocked on record LOCK"

  status = "Program performing EXECUTE/PERFORM"

  status = "Error!! Status unknown"

<47> Status as an integer <threadnext >

<48> User CPU time <threadnext >

<49> System CPU time <threadnext >

<50> Child User CPU time <threadnext >

<51> Child System CPU time <threadnext >

<52> User defined thread data <threadnext >

 

SYSTEM(1028) Logged in database name.
SYSTEM(1029) Returns the CALL stack history as a multi-valued dynamic array where each multi-value is one program in the stack.

The sub-values of each multi-value are:

sub-value 1 = the stack level
sub-value 2 = (reserved)
sub-value 3 = the program line number
sub-value 4 = the program name

This function is not restricted to BASIC programs and will include PROCs and Paragraphs in the stack as well.

See also SYSTEM(40)

SYSTEM(1030) Returns the current perform level in the range 1 to 32. This is similar to SYSTEM(16) which returns the nested execute level. The difference is that SYSTEM(16) does not include any procs, paragraphs and shells and returns the relative application program level. SYSTEM(1030) returns the relative program level including all the proc interpreters, paragraph interpreters and shells.
SYSTEM(1031) Number of free bytes on the current file system.
SYSTEM(1032) Returns default frame size.
SYSTEM(1033) Number of Open files
SYSTEM(1034) Returns handle of the current thread.
SYSTEM(1035) Returns the License Type currently in use by this process (as of jBASE 5.2.14):
    1 = Standard
    4 = Multi-Session
    6 = Web-Session

jBASE 4.1:
    1 = Enterprise

    13 = Server

SYSTEM(1036) Number of 'Blocked Locks', i.e. the number of times that READU 'LOCKED' was (or would have been) taken.
SYSTEM(1037) Process ID  (PID) of this process
SYSTEM(1038) Number of Hashed file frames accessed:
    SYSTEM(1038)<1> = Frames READ
    SYSTEM(1038)<2> = Frames written from a WRITE
    SYSTEM(1038)<3> = Frames SELECTed
SYSTEM(1039) TBD
SYSTEM(2092) Return current prompt character(s) (D3 emulation only)

jBC