Previous Topic: DELETE FROM Statement—Delete a RowNext Topic: FETCH Statement—Retrieve Row Values


DROP TABLE Statement—Remove Table from DIV Data Set

The DROP TABLE statement lets you remove a relational table from the DIV data set. You must use the DELETE FROM statement to delete all the rows in a table before you can delete the table. The deletion of table rows prevents the accidental deletion of a table that contains information that a rule or an automation procedure requires.

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

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

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

OPSQL DROP TABLE
{tablename}

Note: You can use a host variable for tablename.

You may specify these operands for the DROP TABLE statement:

tablename

Defines the 1- to 18-character name of the table to be removed.

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 as the value of sysnames.

Note: For more information about the SYSTEM operand, 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: Delete the SYSTEMS Table

The following two statements delete the SYSTEMS table. The first statement deletes all contents of all rows in the table. The DROP TABLE statement then deletes the empty table.

ADDRESS SQL
  "DELETE FROM SYSTEMS"
ADDRESS SQL
  "DROP TABLE SYSTEMS"