(Contents)(Previous)(Next)

System or $ Variables

SQL-PL makes numerous system values available in system variables. All system variables start with the '$' sign. For this reason, the concept $ variable is used as a synonym for system variable.

System variables return either a numeric value, a string or a logical value. In the following, all system variables will be explained. In part there is a further explanation of the system variables provided with the subjects in whose context the $ variable is used.

$CURSOR

specifies the last position of the cursor in the form, that is, the sequential number of the input field or NULL if the cursor was not positioned at any input field (see also chapter Cursor Control (MARK, $CURSOR) of chapter General Points on Forms and Menus).

$COUNT

After one of the SQL statements INSERT, UPDATE, DELETE or SHOW, the $COUNT variable can be used to find out whether the statement was successful and, if so, how many rows were affected by the statement. $COUNT returns either 0, the precise number of inserted, updated, deleted or found rows or NULL if the number of rows found is unknown after a SELECT (see chapter Database Accesses).

$RC $SQLCODE

The $RC variable (synonym: $SQLCODE) always returns a numeric error code after every SQL statement. The value 0 means that the SQL statement has been successfully executed.

Detailed descriptions of $RC are contained in all chapters concerning database accesses.

$RT $SQLERRMC

Parallel to $RC, the variable $RT (synonym: $SQLERRMC) returns an explanation of the error with a maximum length of 80 characters.

$SQLWARN

The variable $SQLWARN is a logical expression. If an SQL statement returns warnings, the program branches to the THEN part at IF $SQLWARN. Subsequently, the warnings that have actually been set can be displayed via $SQLWARN(1) to $SQLWARN(15).

(For SQLWARN see the manual on the CALL Interface.)

Example:

$SQLERRPOS

After a syntax error, the position within the SQL statement that led to the error is available in $SQLERRPOS.

$SYSRC

After all file accesses, the variable $SYSRC returns a numeric error code. Even for the call of an operating system command error situations may occur which can be requested via $SYSRC.

$SYSRT

The variable $SYSRT contains an error text belonging to $SYSRC.

$USER, $GROUP, $USERMODE

The variable $USER returns the user name of the user currently using ADABAS, $GROUP the group name. If the user is not a member of a group, $GROUP as well as $USER return the name of the user. $USERMODE returns the status (STANDARD, RESOURCE, DBA) of the user.

$SERVERDB

The variable $SERVERDB returns the name of the database with which the user is currently working.

$ROWNO, $COLNO

After a REPORT call, the variables $ROWNO and $COLNO return the row and column of the REPORT display in which the cursor was last positioned. If the cursor was positioned outside the REPORT display, $ROWNO and $COLNO are 0.

$EDITLINES

The variable $EDITLINES returns the number of edit lines after the editor call.

$SCREENCOLS, $SCREENLNS

The variables $SCREENLNS and $SCREENCOLS provide the length and width of the window occupied by the form that was last called.

$MAXLINES, $MAXCOLS

The maximum size of a form is restricted by the physical size of the screen. The variables $MAXLINES and $MAXCOLS return the maximum length and width of the screen.

$KEYLINES, $MSGLINES

With some types of screen, FORM can make use of additional lines on the screen. If the implicit message line is used, the MESSAGE is output in an additional system line, if possible. Likewise, FORM uses a display line provided on some screens for this purpose to output the key assignments. With the variables $KEYLINES and $MSGLINES it is specified whether and how many lines are available for each purpose.

$KEY

The variable $KEY returns the last release key.

$ACTION

The variable $ACTION returns the action of the action bar that was last activated (see chapter Action Bar with Pulldown Menus and BUTTON Bar). This can also be the value NULL if the pulldown menu was left with the key .

$FUNCTION

The dollar variable $FUNCTION returns the function of the pulldown menu hierarchy that was finally chosen. This can also be the value NULL if the pulldown menu was left with the key . If, however, an action of the action bar was chosen that does not have a pulldown menu, $FUNCTION returns the same value as $ACTION.

$FUNCTION1, ... $FUNCTION4

The dollar variables $FUNCTION1 to $FUNCTION4 return the function last chosen from the pulldown menu level designated by its number. In this way it is possible to distinguish the same pulldown menus several times within a pulldown menu hierarchy (examples are contained in the chapter General Points on Forms and Menus).

$CMD

$CMD returns the command line entered in the editor.

$ITEMS

Returns the number of recognized or modified arguments as the result of the functions TOKENIZE, SEPARATE, and CHANGE.

$SEC, $MICRO

The variables $SEC and $MICRO return the time passed between INITTIME and GETTIME (see also chapter Time Measuring Functions).

$OS

The variable $OS returns the name of the operating system used. The following text constants are possible as values:

'MSDOS'

'OS2'

'UNIX'

'VMS' as well as

NULL, if the operating system could not be recognized.

$TERM

The variable $TERM returns, as string, the type of the current terminal as specified by the environment variables $TERM or $DBTERM. $DBTERM is evaluated first. If it does not return a value, $TERM is evaluated. If this does not return a value either, the result is NULL.

Syntax:


(Contents)(Previous)(Next)