Command types and environments in Db2

Db2 supports several different types of commands that you can use to complete database administration tasks.

The commands are divided into the following categories:

The DSN command and subcommands

DSN is the Db2 command processor and executes as a TSO command processor.

Start of changeAll of the DSN subcommands, except SPUFI, run under DSN in either the foreground or background. All commands except BIND QUERY and END also run under Db2 Interactive (DB2I). SPUFI runs only in the foreground under ISPF.End of change

ABEND (DSN) The DSN subcommand ABEND causes the DSN session to terminate with abend completion code X'04E' and reason code of X'00C50101'.
Important: Start of changeThe ABEND subcommand is used for diagnostic purposes only, and is intended to be used only under the direction of IBM® Support. Use it only when diagnosing a problem with DSN or Db2.End of change
BIND PACKAGE (DSN) The DSN subcommand BIND PACKAGE builds an application package. Db2 records the description of the package in the catalog tables and saves the prepared package in the directory. Start of changeBIND PACKAGE also deletes phased-out package copies.End of change
BIND SERVICE (DSN) The BIND SERVICE (DSN) subcommand builds an application package that represents a Db2 REST service.
BIND PLAN (DSN) The DSN subcommand BIND PLAN builds an application plan. All Db2 programs require an application plan to allocate Db2 resources and support SQL requests made at run time.
BIND QUERY (DSN) The DSN subcommand BIND QUERY reads the statement text, default schema, and a set of bind options from every row of DSN_USERQUERY_TABLE, and information from correlated EXPLAIN table rows. When LOOKUP(NO) is in effect, Db2 inserts the pertinent data into certain catalog tables.
DSN (TSO) The TSO command DSN starts a DSN session.
END (DSN) The DSN subcommand END is used to end the DSN session and return to TSO.
FREE PACKAGE (DSN) The DSN subcommand FREE PACKAGE can be used to delete a specific version of a package, all versions of a package, or whole collections of packages.
FREE SERVICE (DSN) The FREE SERVICE (DSN) subcommand deletes an application package that represents a Db2 REST service.
FREE PLAN (DSN) The DSN subcommand FREE PLAN deletes application plans from Db2.
FREE QUERY (DSN) The DSN subcommand FREE QUERY removes from certain catalog tables for one or more queries. If any of the specified queries are in the dynamic statement cache, FREE QUERY purges them from the dynamic statement cache.
Start of changeFREE STABILIZED DYNAMIC QUERY subcommand (DSN)End of change Start of changeThe DSN subcommand FREE STABILIZED DYNAMIC QUERY removes from certain catalog tables one or more stabilized dynamic queries. If any of the specified queries are in the dynamic statement cache, FREE STABILIZED DYNAMIC QUERY also purges the statements from the dynamic statement cache.End of change
DCLGEN (DECLARATIONS GENERATOR) (DSN) The declarations generator (DCLGEN) produces an SQL DECLARE TABLE statement and a COBOL, PL/I, or C data declaration for a table or a view named in the catalog.
REBIND PACKAGE (DSN) The DSN subcommand REBIND PACKAGE rebinds an application package when you make changes that affect the package, but have not changed the SQL statements in the program.
REBIND PLAN (DSN) The DSN subcommand REBIND PLAN rebinds an application plan when you make changes to the attributes of the plan, such as the package list.
REBIND TRIGGER PACKAGE (DSN) Start of changeThe DSN subcommand REBIND TRIGGER PACKAGE rebinds a package for a basic trigger. You can identify basic triggers by querying the SYSIBM.SYSTRIGGERS catalog table. Blank values in the SQLPL column identify basic triggers. For advanced triggers, use the REBIND PACKAGE command instead.End of change
RUN (DSN) The DSN subcommand RUN executes an application program, which can contain SQL statements.
SPUFI (DSN) The DSN subcommand SPUFI executes the SQL processor using file input.

Db2 commands

You can use Db2 commands to control most of the operational environment.

START DB2 commands can be issued only from a z/OS®console or TSO SDSF. All other Db2 commands can be issued from the following environments:

  • z/OS consoles
  • TSO terminals, by any of the following methods:
    • Issuing the DSN command from the TSO READY prompt
    • Entering commands in the DB2 Commands panel inDB2I
  • IMS terminals
  • Authorized CICS® terminals
You can issue many commands from the background within batch programs, such as the following types of programs:
  • z/OS application programs
  • Authorized CICS programs
  • IMS programs
  • APF-authorized programs, such as a terminal monitor program (TMP)
  • IFI application programs

Db2 commands that are issued from a logged-on z/OS console or TSO SDSF can be checked by Db2 authorization using primary and secondary authorization IDs. Start of changeA logged-on z/OS user ID must be defined in RACF or a similar security server.End of change

For detailed descriptions of the Db2 commands, see the commands with names that are preceded by the recognition character - and identified by (Db2) in Db2 commands.

The extended MCS console feature enables a z/OS system have more than 99 consoles. Because Db2 supports extended MCS consoles, messages returned from a Db2 command are routed to the extended MCS console that issued the command.

Message DSN9022I indicates the normal end of Db2 command processing; DSN9023I indicates the abnormal end of Db2 command processing.

IMS commands

You can use the following IMS commands to control IMS connections as well as to start and stop connections to Db2 and display activity on the connections. You can issue IMS commands from an IMS terminal or you can invoke IMS transactions or commands by using the Db2-supplied stored procedures DSNAIMS or DSNAIMS2. DSNAIMS2 has the same functions as DSNAIMS but also provides multi-segment input support for IMS transactions.

For descriptions of the IMS commands, see IMS commands.

/CHANGE (IMS) Resets an indoubt unit of recovery as identified by the OASN keyword of the /DISPLAY command. That command deletes the item from the standpoint of IMS, but it does not communicate to Db2. For example, issue the following command to reset all indoubt units of recovery for the subsystem named Db2:
/CHA SUBSYS DB2 RESET
Issue the following command to reset all indoubt units of recovery for all subsystems:
/CHA SUBSYS ALL RESET
Issue the following command to reset indoubt recovery units with OASN numbers 99, 685, and 2920 for subsystem Db2:
/CHA SUBSYS DB2 OASN 99 685 2920 RESET
/DISPLAY (IMS) Displays the status of the connection between IMS and an external subsystem (as well as all application programs communicating with the external subsystem), or the outstanding recovery units that are associated with the subsystem. For example, you can issue the following command to display the status of all connections with IMS:
/DISPLAY SUBSYS ALL

The result is similar to the following output:

SUBSYS    CRC    REGID    PROGRAM    LTERM    STATUS
SSTR      ?                                   CONN
                   1      DDLTLM17   PTERM01  CONN,ACTIVE
                   2      DDLTLM06   PTERM02  CONN
*85202/065933*
/SSR (IMS) Allows the IMS operator to enter an external subsystem command.
/START (IMS) Makes the connection between IMS and the specified external subsystem available. Establishing the connection allows application programs to access resources managed by the external subsystem.
/STOP (IMS) With the SUBSYS parameter, prevents application programs from accessing external subsystem resources.
/TRACE (IMS) Directs and controls the IMS capabilities for tracing internal IMS events. It also starts, stops, and defines the activity to be monitored by the IMS Monitor. For example, the following command starts IMS trace, enables the Db2 trace, and writes IMS trace tables to the IMS log before they wrap:
/TRACE SET ON TABLE SUBS OPTION LOG
The following command starts IMS tracing, enables all trace tables (including Db2 trace tables); (ALL is the default parameter for the TABLE keyword), and writes IMS trace tables to the IMS log before they wrap.
/TRACE SET ON TABLE ALL OPTION LOG

CICS attachment facility commands

You can use CICS commands to control CICS connections as well as to start and stop connections to Db2 and display activity on the connections. Each CICS attachment facility command can be issued from a CICS terminal.

Administrative task scheduler commands

You can use administrative task scheduler commands to start, stop, and change the administrative task scheduler. All administrative task scheduler commands can be issued from a z/OS console.

MODIFY admtproc,APPL=SHUTDOWN command The MODIFY admtproc, APPL=SHUTDOWN command stops the administrative task scheduler from accepting requests and starting new task executions. It also shuts down the administrative task scheduler.
MODIFY admtproc,APPL=TRACE command The MODIFY admtproc, APPL=TRACE command starts or stops traces in the administrative task scheduler.
START admtproc command The START admtproc command starts the scheduler that is specified in the admtproc parameter
STOP admtproc command (z/OS ) The STOP admtproc command stops the administrative task scheduler that is specified in the admtproc parameter.

z/OS IRLM commands

You can use z/OS Internal Resource Lock Manager (IRLM) commands to start, stop, and change the IRLM. All z/OS IRLM command can be issued from a z/OS console.

MODIFY irlmproc,ABEND (z/OS IRLM) The MODIFY irlmproc, ABEND command terminates IRLM abnormally. IRLM processes this command even if a Db2 subsystem is identified to it.
MODIFY irlmproc,DIAG (z/OS IRLM) The MODIFY irlmproc, DIAG command initiates diagnostic dumps for IRLM subsystems.)
MODIFY irlmproc,PURGE (z/OS IRLM) The MODIFY irlmproc,PURGE command releases IRLM locks retained due to a Db2, IRLM, or system failure.
MODIFY irlmproc,SET (z/OS IRLM) The MODIFY irlmproc,SET command dynamically sets various IRLM operational parameters
MODIFY irlmproc,STATUS (z/OS IRLM) The MODIFY irlmproc,STATUS command displays information for one or more subsystems connected to the IRLM that is specified using irlmproc .

TSO CLISTs

You can use Time Sharing Option (TSO) commands to perform TSO tasks such as prepare and execute programs under TSO.