RUN command

Use the RUN command to run queries or procedures.

Syntax

To run a query, use the following command:


>>-RUn-+-------+-objectname-+-------------------------+-<<
       +-QUERY-+           (+-ACCElerator=value-------+
                            +-ACCELERATORDATABASE=name+
                            +-ACTion=append/replace---+
                            +-COMment=comment_text----+
                            +-CONfirm=Yes/No----------+
                            +-Form=FORM/formname------+
                            +-METHOD=method_name------+
                            +-MODE=GRID/RAW-----------+
                            +-ROWIDADD=YES/NO---------+
                            +-ROWIDDISP=value---------+
                            +-ROWIDNAME=text----------+
                            +-ROWLimit=integer--------+
                            +-SPACE=value-------------+
                            +-SPACE DATABASE=database-+
                            +-SCOPE=integer-----------+
                            +-Table=tablename---------+
                            +-&&variablename=value----+

Uppercase letters in the diagram show the minimum set of letters required to issue the command.

To run a procedure, use the following command:


>>-RUn-+------+-objectname-+--+----------------------+-<<
       +-PROC-+              (+-&&variablename=value-+

Uppercase letters in the diagram show the minimum set of letters required to issue the command.

Parameters

The following parameters can be specified for the RUN QUERY command:

objectname
Specifies the name of the query that you want to run.
CONFIRM
Specifies whether or not to display a confirmation dialog before replacing or changing an object as a result of this command.
FORM
If you are running a query that must return a report, use this parameter to indicate which QMF form to use to format the selected data. You can specify the keyword FORM to use the form object that is currently stored in the temporary storage, or specify the name of a form that is saved in the database. Note, that if the temporary storage contains more than one open form at the same time, the most recently opened one will be used.
ROWLIMIT
Specifies the maximum number of table rows to include in the query result set.
&&variablename
Assigns a value to a variable in the query. The variable name can be 1 to 17 characters long and the value can be 1 to 55 characters long. You can specify any number of variables and values with the RUN command. The variable name must be prefaced with two ampersands and enclosed in quotation marks.
ACTION
Specifies whether you want to replace the entire database table with the data returned by the query or to append the data to the existing table. This option is valid only if the TABLE option is also specified. Valid values are REPLACE and APPEND.
TABLE
Specifies that you want to insert the query results into a table. Valid value for this parameter is the name of the table.
COMMENT
Creates a comment and stores it with the data that is returned by the query and inserted into the specified table. This option is valid only if the TABLE option is also specified.
SPACE
Specifies the storage space to hold any tables that are created by the SAVE DATA command. If you leave the value of this parameter blank, the application uses the default space chosen by the database manager program.
SPACE DATABASE
Specifies the database name to save the table in a particular database container. The table space is created automatically under the name of the created table. This parameter is used only for z/OS databases.
ACCELERATOR
Specifies the name of the accelerator in which the table will be created.
ACCELERATORDATABASE
Specifies the name of the database that you want to use to save accelerator-only tables. The ACCELERATORDATABASE keyword can be up to 128 characters long. The default value of the ACCELERATORDATABASE parameter is taken from the DSQEC_SAV_ACCELDB global variable. If the DSQEC_SAV_ACCELDB global variable value is not empty, the database specified by the SPACE keyword is ignored.
MODE
Specifies whether the query result set is saved with the formatting and added calculated columns. Valid values are:
RAW
Saves the query result set without the formatting and added calculated columns.
GRID
Saves the query result set with the formatting and added calculated columns.
METHOD
Specifies the method of saving the query result set. Valid values are:
REGULAR
Sends the query result set data from the client back to the database server where it is inserted into the table.
FAST
Reruns the query at the server and inserts the query results directly into the table.
FASTSAFE
Reruns the query at the server without the ORDER BY clauses and inserts the query results directly into the table.
ROWIDADD
Specifies whether to add the Row ID column to the table.
ROWIDDISP
Specifies the disposition of the new Row ID column.
ROWIDNAME
Specifies the name for the new Row ID column.
SCOPE
Specifies the commit scope of the data.

The following parameters can be specified for the RUN PROC command:

objectname
Specifies the name of the procedure that you want to run.
&&variablename
Assigns a value to a variable in the procedure. The variable name can be 1 to 17 characters long and the value can be 1 to 55 characters long. You can specify any number of variables and values with the RUN command. The variable name must be prefaced with two ampersands and enclosed in quotation marks.

Examples

RUN PROC EXAMPLE_PROCEDURE (&&VAR='example_value'
RU QUERY EXAMPLE_QUERY (&&VAR='example_value' rowlimit=5