(Contents)(Next)

Stored Commands

The command or the sequence of commands in the input area can be permanently stored by using the STORE command. When doing so, the user assigns a command name with which the command can be called at any time.

To be able to store commands, the ADABAS user must have at least RESOURCE status.

A command may contain up to 16 formal parameters (&i or %i) which will be substituted by actual position parameters when the command is being called. With a call, the actual parameters can be specified immediately after the command name (separated by blanks).

As an alternative to the foregoing procedure, a form can be defined within the command. When the command is called, this form will be displayed requesting the actual parameters to be input. Then the command will have the following structure:

LAYOUT definition (optional)

SQL statement

REPORT commands (optional)

Text between LAYOUT and ENDLAYOUT will be displayed without any changes, and an input field will be created for each &i. Then the value specified at &i will be inserted into the SQL statement instead of the parameter &i.

Example:

LAYOUT

customer-table for city

_______________________

city : &1

ordered by : &2 := 1 (1 = customer-no

2 = name

3 = account)

ENDLAYOUT

SELECT cno, name, account

FROM customer

WHERE city = '&1' ORDER BY &2

REPORT

TTITLE 'customer-table for city &1'

Comments

1. The form must not be larger than the screen. Each input field is limited by the next following character or by the end of line.

2. QUERY neither checks whether the form contains all formal parameters nor checks whether all fields have been filled in when calling the form. No input checks are made either.

3. Default settings for parameters can be defined in the form itself. If the default value is to contain blanks, it must be enclosed in single quotes. Notation:

&i := default value

4. The form can contain language-dependent literals which will be substituted before being output. The different sizes of the literals for the different languages must be stored in a special table in the database. If a literal cannot be found, then the name of the literal will be output to the screen.

A literal specified in the form begins with an exclamation mark ('!').

5. The form is closed when the SQL statement has been executed successfully or has been cancelled with the key.

Each user who is authorized to create stored commands has a command library of his own. For commands in his own library, the user can grant call privileges to other users.

Like table names, the command names of stored commands can be qualified with the user name:

miller.customertable

The owner name need not be mentioned for a command in a user's own library.

Stored commands can contain comment lines. These must begin with / or *. Note that comment lines which are not placed at the beginning of a stored command serve to separate several SQL statements.


(Contents)(Next)