@


The @ function is used to position the cursor to a specific point on the terminal screen.

 

COMMAND SYNTAX

@(col{, row})

 

SYNTAX ELEMENTS

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.

 

NOTES

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.

 

EXAMPLES

FOR I = 1 TO 5
    CRT @(5, I):"*":
NEXT I

Home = @(0,0) ;* Remember the cursor home position
CRT Home:"Hi honey, I"m HOME!":

 


@(SCREENCODE)

The @(ScreenCode) function is also used to output control sequences according to the capabilities of the terminal.

 

COMMAND SYNTAX

@(ScreenCode)

 

SYNTAX ELEMENTS

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.

 

NOTES

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.

Emulation Code Function
all -1 clear the screen and home the cursor
all -2 home the cursor
all -3 clear screen from the cursor to the end of the screen.
all -4 clear screen from cursor to the end of the current screen line.
ros -5 turn on character blinking
ros -6 turn off character blinking
ros -7 turn on protected field mode
ros -8 turn off protected field mode
all -9 move the cursor one character to the left
all -10 move the cursor one row up the screen
ros -11 turn on the cursor (visible)
ros -11 enable protect mode
ros -12 turn off the cursor (invisible)
ros -12 disable protect mode
ros -13 status line on
ros -13 turn on reverse video mode
ros -14 status line off
ros -14 turn off reverse video mode
ros -15 move cursor forward one character
ros -15 turn on underline mode
ros -16 move cursor one row down the screen
ros -16 turn off underline mode
all -17 turn on the slave (printer) port
all -18 turn off the slave (printer) port
ros -19 dump the screen to the slave port
ros -19 move the cursor right one character
ros -20 move the cursor down one character
ros -311 turn on the cursor (visible)
ros -312 turn off the cursor (invisible)
ros -313 turn on the status line
ros -314 turn off the status line

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:

Bit 0 dimmed mode when set to 1
Bit 1 flashing mode when set to 1
Bit 2 reverse mode when set to 1
Bit 3 blanked mode when set to 1
Bit 4 underline mode when set to 1
Bit 5 bold mode when set to 1
Bit 7 always set to 1

Thus Reverse and Flashing mode is -134.

To turn off all effects use -128.

 

EXAMPLES

CRT @(-1):@(30):@(-132):"jBASE Heading":@(-128):
CRT @(5,5):@(-4):"Prompt: ": ; INPUT Answer

 


@APPLICATION.ID

@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...

 


@CALLSTACK

Returns current space information for DEBUG purposes

 


@CODEPAGE

Returns current codepage config jbase_codepage


@DATA

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


@DATE

Returns 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


@DAY

Day of month from @DATE


@EOF

End of File character from TTY characteristics


@FILENAME

Current filename


@FOOTER.BREAK

For B options in heading


@HEADER.BREAK

For B options in heading


@LEVEL

The nesting level of execution statements – non stacked


@LOCALE

Returns current Locale as jbase_locale


@LPTRHIGH

Number of lines on the device to which you are printing (that is, terminal or printer)


@MONTH

Current Month


@PARASENTENCE

The last sentence or paragraph that invoked the current process.


@PATH

Pathname of the current account


@PID

Returns current process ID


@RECORD Entire current record


@SELECTED

Number of elements from the last select list – Non stacked


@TERMTYPE

The Terminal type


@TIME

Returns 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


@TIMEZONE

As per jBASE Timezone


@TTY

Returns the terminal port name


@UID

Returns information from ROOT.THREAD for port @user


@USER.ROOT

The 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.

For example

@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"


@USER.THREAD

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"


@USERSTATS

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 ...

INCLUDE JBC.h

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

*

SELECT PROC

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>

*

END

REPEAT

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


jBC