The @ function is used to position the cursor to a specific point on the terminal screen.
col and row can be any expression that evaluates to a numeric value. col specifies which column on the screen the cursor should be moved to. row specifies which row (line) on the screen to position the cursor. col may be specified on its own, which will cause the cursor to the required column on whichever row it currently occupies.
When values are specified that exceed either of the physical limits of current terminal, then unpredictable results will occur.
The terminal is always addressed starting from (0,0), being the top left hand corner of the screen.
Cursor addressing will not normally work when directed at a printer. If you wish to build printer independence into your programs you may achieve this by accessing the terminfo database through the SYSTEM( ) function.
The @(ScreenCode) function is also used to output control sequences according to the capabilities of the terminal.
Control sequences for special capabilities of the terminal are achieved by passing a negative number as its argument. ScreenCode is therefore any expression that evaluates to a negative argument.
jBASE has been designed to import code from many older systems. As these systems have traditionally not co-ordinated the development of this function they expect different functionality in many instances. In the following table you should note that different settings of the JBCEMULATE environment variable will elicit different functionality from this function. Where the emulate code is printed with strikethrough it indicates that the functionality is denied to this emulation.
If a color terminal is in use, -33 to -64 will control colors.
The codes from -128 to -191 control screen attributes. Where Bit 0 is least significant you may calculate the desired code by setting Bit 7 and Bits 0-4:
Thus Reverse and Flashing mode is -134.
To turn off all effects use -128.
@ID Dataname used to reference the record-id in a query language statement:
SORT STOCK BY-DSND @ID
LIST STOCK WITH @ID = "1000"
LIST STOCK WITH @ID LIKE AB...
@CALLSTACKReturns current space information for DEBUG purposes
@CODEPAGEReturns current codepage config jbase_codepage
Data statements used in conjunction with INPUT statements are stored in a data stack or input queue. This stack is accessible in the @DATA variable
@DATEReturns the internal date – on some systems, this differs from the DATE function in that the variable is set when program execution starts, whereas the function reflects the current date
@DAYDay of month from @DATE
@EOFEnd of File character from TTY characteristics
@FOOTER.BREAKFor B options in heading
For B options in heading
The nesting level of execution statements – non stacked
Returns current Locale as jbase_locale
@LPTRHIGHNumber of lines on the device to which you are printing (that is, terminal or printer)
@PARASENTENCEThe last sentence or paragraph that invoked the current process.
@PATHPathname of the current account
@PIDReturns current process ID
@RECORDEntire current record
@SELECTEDNumber of elements from the last select list – Non stacked
@TERMTYPEThe Terminal type
@TIMEReturns the internal time – on some systems, this differs from the TIME function in that the variable is set when program execution starts, whereas the function reflects the current time
As per jBASE Timezone
@TTYReturns the terminal port name
@UIDReturns information from ROOT.THREAD for port @user
@USER.ROOTThe use of the @USER.ROOT command allows a jBASE BASIC program to store and retrieve a string of up to 63 bytes that is unique to that user. The intention is to really "publish" information that other programs can find.
@USER.ROOT = "jBASE International Inc"
PRINT "root user declaration is " : @USER.ROOT
See attribute <28> , USER_PROC_USER_ROOT, in the section "Layout of user record"
The @USER.THREAD is similar except a value exists for each PERFORM level. So one program can set/retrieve it but if the program does a PERFORM of a second program then the second program gets a different set of values.
See attribute <52> , USER_PROC_USER_THREAD, in the section "Layout of user record"
The @USERSTATS allows a program to retrieve all sorts of miscellaneous information about itself. For example if a program wants to find out how many database I/O's it performed it could do this ...
info1 = @USERSTATS
read1 = info1<USER_PROC_STATS_READ>
EXECUTE 'COUNT fb1 WITH *A1 EQ "x"'
info2 = @USERSTATS
read2 = info2<USER_PROC_STATS_READ>
PRINT "The COUNT command took ":(read2-read1):" READ's from the database"
So a program can set a user-definable string to whatever value it likes , up to 63 bytes, and other programs can use various methods
(see "User Information Retrieval" below) to access this data.
User Information Retrieval
There are 3 ways of finding information about one or more users on a jBASE system
1. Using the @USER.ROOT, @USER.THREAD and @USERSTATS variables in your jBASE BASIC code you can find
information about yourself. You cannot find information about other users.
2. The "WHERE (V)" command can be used to display the @USER.ROOT and @USER.THREAD data for specified users.
3. Using some jBASE BASIC code you can find out lots of information about each user on the system. This is exactly the mechanism that the WHERE command uses. For example to display all users logged on you could write this.
* Open the special jEDI file to access the user information.
OPEN SYSTEM(1027) TO PROC ELSE STOP 201,SYSTEM(1027)
* For each user logged on read in their user information
LOOP WHILE READNEXT key DO
READ rec FROM PROC,key THEN
PRINT "Port ":rec<USER_PROC_PORT_NUMBER>:" is logged on by user ":rec<USER_PROC_ACCOUNT>
Layout of user record
The information retrieved by either the READ in the above example or the @USERSTATS is the same and is as follows.
The first 40 attributes are data attributes that correlate to the entire user. Attributes 41 onwards are multi-valued and have one value per program being PERFORM'ed by that user
All the numbers below can be replaced by symbolic references in JBC.h , look for those that begin USER_PROC_
<1> The port number
<2> The number of programs running in this port.
<3> Time the user started in Universal Co-ordinated Time or UTC (not a dyslexic mistake). This is raw UNIX time. You can convert this to jBASE internal time format using the U0FF0 conversion or to internal date format using the U0FF1 conversion.
<4> The process ID
<5> Account name
<6> User name. Normally the operating system name.
<7> Terminal name in jBASE format
<8> Terminal name in Operating system format.
<9> Database name
<10> TTY device name
<11> Language name.
<12> Time in UTC the listening thread last found the thread alive.
<13> Amount of heap space memory in free space chain on a process wide basis. Not real-time, only updated every 15 seconds.
<14> Amount of heap space memory in use on a process wide basis. Not real-time , only updated every 15 seconds
<15> Thread type as an internal integer.
<16> Type of thread as a text string.
<17> License counters
<18> Number of OPEN’s performed.
<19> Number of READ’s performed.
<20> Number of WRITE's performed.
<21> Number of DELETE's performed
<22> Number of CLEARFILE's performed
<23> Number of PERFORM/EXECUTE's performed.
<24> Number of INPUT's performed.
<25> Not used.
<26> Number of jBASE files the application thinks it has open at the moment.
<27> Number of jBASE files actually opened by the operating system at the moment.
<28> Any data set by the application using @USER.ROOT
<29> Process Identifier. A string created by the operating system to identify the process. It is O/S specific. Currenly on IBM i-series platform only.
<30> to <40> Reserved.
Attributes 41 onward are multi-valued, one value per perform level, and there are <2> perform levels active.
<41,n> Program name and command line arguments.
<42,n> The line number in jBASE BASIC the program is currently executing.
<43,n> The source name in jBASE BASIC the program is currently executing.
<44,n> Not used.
<45,n> Not used.
<46,n> Status of program execution as a readable text string.
<47,n> Status of program execution as an internal integer.
<48,n> User CPU time . Depending upon the hardware this will be either for the entire process or just the single thread.
<49,n> System CPU time.Depending upon the hardware this will be either for the entire process or just the single thread.
<50,n> User CPU time used by any external child processes it might have spawned.
<51,n> System CPU time used by any external child processes it might have spawned.
<52,n> Any data set by the application using @USER.THREAD