(Contents)(Previous)(Next)

Calling QUERY

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

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

In this case, QUERY suppresses any screen interaction and terminates after execution.

To execute the process in the background, specify the corresponding shell command (&):

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 of these call formats can also be used from a shell script.

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 the background, specify the corresponding shell command (&):

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 of the stored command 'COMMAND1'.

The blank has the effect of a separator between two parameters.

All of these call formats can also be used from a shell script.

Exporting or Importing Commands in Batch Mode

xquery -e HOTEL, hot.cmd

xquery -i hot.cmd

In the first example, QUERY exports the stored command 'HOTEL' into the UNIX file 'hot.cmd'. In the second example, QUERY imports all stored commands recorded in the UNIX file 'hot.cmd'. In both cases, no screen interaction takes place. QUERY terminates after execution.

Specifying '-A' (APPEND) ensures that text is added at the end of an already existing file rather than overwriting the file.

To execute the process in the background, specify the corresponding shell command (&):

xquery -i hot.cmd &

All of these call formats can also be used from a shell script.

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 is displayed. The user can then execute any displayed command but cannot create new commands.


(Contents)(Previous)(Next)