


Format:


Calling QUERY (general format)
xquery
The options -u, -U, -d, and -n required for the connect are described in Section Establishing a Database Session, the options -V and -h in Section General Information.
After the connect, the user is in input mode where the SQL statements can then be entered.
Specifying a TIMEOUT Value
The SESSION TIMEOUT value determines the time interval at the end of which the session will be terminated if it was not active. The database administrator can determine this value for the whole database using CONTROL or for a single user on his creation (default: 300 seconds). The option -t allows the user to specify a smaller value in seconds. A value larger than predefined produces an error message.
xquery -t 90
The database session started with this call is terminated after 90 seconds of inactivity
Calling QUERY in SELECT Mode
xquery -s
In SELECT mode, only read accesses to database objects can be performed. This mode is valid during the whole QUERY session.
Specifying an SQLMODE
The option -S can be used to specify the SQLMODE desired for the call. If the option is not used, QUERY works in the default mode ADABAS.
xquery -S ANSI
Specifying a Command File With a Call
In QUERY, command files can be started interactively or in batch mode. Calls are for the
1) interactive mode:
xquery -u parker,secret -d testdb -r filename
QUERY executes the statements of the command file and then displays the input screen.
2) batch mode:
xquery -u parker,secret -d testdb -b filename parm1 parm2
In this case, QUERY suppresses any screen interaction and terminates after execution.
To execute the process in a new window (as a background process), specify the corresponding Windows NT command (DETACH):
start /min xquery -b filename
The contents of the specified file are copied into the edit area and executed. The command file must therefore contain a sequence of SQL and report statements separated by comment lines. The command file must not exceed 12 K (see ADABAS manual QUERY).
3) execution with parameter transfer
xquery -r filename 21.00 Mayr
xquery -b filename 21.00 Mayr
In this example, the values '21.00' and 'Mayr' are assigned to the formal parameters of the command file 'filename'.
The blank has the effect of a separator between two parameters.
All these call formats can also be used from a Windows NT command file.
Specifying a Command With a Call
In QUERY, stored commands can be started interactively or in batch mode. Calls are for the
1) interactive mode:
xquery -u parker,secret -d testdb -R HOTEL
QUERY executes the specified command and then displays the input screen.
2) batch mode:
xquery -u parker,secret -d testdb -B HOTEL
In this case, QUERY suppresses any screen interaction and terminates after execution.
To execute the process in a new window (as background process), specify the corresponding Windows NT command (START):
start /min xquery -B HOTEL
3) execution with parameter transfer
xquery -R command1 21.00 Mayr
xquery -B command1 21.00 Mayr
In this example, the values '21.00' and 'Mayr' are assigned to the formal parameters (&1, &2, ...) of the stored command 'COMMAND1'.
The blank has the effect of a separator between two parameters.
Exporting or Importing Stored Commands
xquery -e HOTEL,hotel.qsc
xquery -e *,my.qsc
In the first example, QUERY exports the stored command 'HOTEL' into the Windows NT file 'hotel.qsc'. In the second example, QUERY exports all stored commands of the user into the Windows NT file 'my.qsc'.
xquery -i hotel.qsc
QUERY imports all stored commands recorded in the Windows NT file 'hotel.qsc'.
Specifying '-A' (APPEND) ensures that text is added at the end of an already existing file rather than overwriting the file.
In both cases, no screen interaction takes place. QUERY terminates after execution.
All these call formats can also be used from a Windows NT command file.
Calling QUERY With the QUERY Command 'LIST'
xquery -L
Connecting is done in a similar way to that described for the general QUERY call. The user does not access the input mode but the menu of the stored QUERY commands. The user can then execute any displayed command but cannot create new commands.


