Previous Topic: INSERT Statement—Insert Table RowsNext Topic: SELECT Statement—Extract Relational Table Data


OPEN Statement—Initiate Cursor Operation

The OPEN statement lets you initiate a cursor operation. When you issue the OPEN statement, the SELECT criteria for the cursor operation (specified with the DECLARE CURSOR statement) is immediately executed.

Note: The SQL command that executes the OPEN statement must be issued from an AOF rule, an OPS/REXX program, a TSO/E REXX program, or a TSO CLIST. You cannot invoke SQL commands that perform cursor operations from a TSO terminal.

Use this syntax in an AOF rule or an OPS/REXX program:

ADDRESS SQL "OPEN keywords"
{cursorname}
[SYSTEM(ALL|EXT|sysnames)]
[SYSWAIT(seconds)]
[OUTPUT|NOOUTPUT]
[SYSPLEX]
[SUBSYS(subsystem)]

To invoke the statement from a TSO/E REXX program or a TSO CLIST, use this syntax:

OPSQL OPEN {cursorname}

You may specify these operands for the OPEN statement:

cursorname

Defines the name of the cursor you are initiating (previously defined using the DECLARE CURSOR statement).

SYSTEM

(Optional) Performs cross-system SQL operations. Specify one of these values:

ALL

Routes the SQL command to all active MSF-defined systems, including the local system.

EXT

Routes the SQL command to all remote, active MSF-defined systems.

sysnames

Routes the SQL command to the specified systems. You may specify from one to eight system names.

Note: For more information, see the chapter “Using the Relational Data Framework” in the User Guide.

SYSWAIT

(Optional). Defines the number of seconds the SQL processor waits for output from a remote system.

Limits: 1-300 seconds

Note: Do not specify a value for SYSWAIT if you specify the SYSTEM(ALL), SYSTEM(EXT), or NOOUTPUT keywords.

OUTPUT or NOOUTPUT

(Optional) Indicates whether the command returns output to the external data queue. To return output, specify OUTPUT; otherwise, specify NOOUTPUT.

NOOUTPUT is implied when:

SYSPLEX

(Optional) Reduces the scope of the SYSTEM(ALL|EXT) operand to MSF connected systems that belong to the same z/OS sysplex as the command issuer. The keyword has no effect on a list of explicit system names.

SUBSYS

(Optional) Performs SQL operations on other CA OPS/MVS subsystems that are in communication with the current one. Specify the following value:

subsystem

Routes the SQL command to the specified subsystem. You can use only one four-character name of the subsystem as follows: OPSx.

Example: Initiate a cursor operation named STATDOWN

To initiate the cursor operation named STATDOWN, issue this command from an OPS/REXX program:

ADDRESS SQL
  "OPEN STATDOWN"