Running Db2 utilities on tables
You can use Db2 Admin Tool to run the LOAD, UNLOAD, and REORG UNLOAD EXTERNAL utilities on tables. Based on the options that you choose, Db2 Admin Tool generates utility statements for you. You can choose to either save these utility statements in a work statement list (WSL) or generate a batch utility job stream.
About this task
If you want to run a utility against a LISTDEF list of tables, see Running utilities on LISTDEF lists.
Procedure
To run Db2 utilities on tables:
-
Select the tables on which you want to run the utility:
- On the DB2 Administration Menu (ADB2) panel, specify option 1, and press Enter.
- On the System Catalog (ADB21) panel, specify option T. Optionally specify any filtering criteria at the bottom of the panel, and press Enter.
-
On the Tables, Views, and
Aliases (ADB21T) panel, select
one or more tables:
- If you want to select one table, issue the UT line command next to the table name, and press Enter.
- If you want to select more than one table, filter the list as needed, specify the UTIL primary command, and press Enter.
The Tables Utilities (ADB2UT) panel is displayed:The LC option (the cross-loader function of the LOAD utility) is displayed only in the following situations:
- The table does not contain XML columns.
- The panel is displayed for only one table, not multiple tables.
- The target table does not contain GENERATED ALWAYS columns.
- Optional:
Specify the following options as needed:
- BP
- If you plan to generate a batch utility job stream and want to change the JOB statement or other system parameters, specify BP and press Enter. On the resulting Batch Job Utility Parameters (ADB2UPA) panel, specify the options that you want to change. Then, press PF3 to save your changes and return to the Tables Utilities (ADB2UT) panel.
- TU
- If you plan to use templates and want to specify which template to use for a given utility option, specify TU. Then, follow the instructions in Associating data set templates with keywords.
- In the Option field, specify a utility to run on the selected table. For example, specify UL to run the UNLOAD utility.
-
Change any of the following control options, and press Enter:
- Review/change options
- Specify whether you want to review and change the utility options. If the value is NO, the default options for the selected utility are used.
- Generate work statement list
- Specify whether you want the utility control statements to be added to a work statement list (WSL). If the value is NO, an executable utility job stream is generated instead. If you specify LO as the utility, Generate work statement list must be NO.
- Generate template statements
- Specify whether you want templates to be used. If the value is YES, Db2 Admin Tool uses the active templates
that are defined. (If you want to change these templates, specify the TU
option.)
Db2 Admin Tool does not generate any TSODELETE statements to delete any existing data sets for the template first. To ensure that any existing data sets are deleted, consider using one of the following techniques when you define the template:
- Specify the data set name pattern as a GDG (generation data group) where the next data set in the sequence is generated (+1), and change the other common options so that the GDGLIMIT is 1. This setup causes the data sets in the group to roll off so that only one data set exists at any one time. For example, a data set pattern name might be specified as &db..&ts..&name..ic(+1).
- Specify a DISP option of NEW, DELETE, DELETE for the data set, if appropriate.
-
If the Specify Utility
Options panel is displayed, specify
any additional options, and press Enter.
This panel is not displayed in the following situations:
- If you specified LX
- If you specified Review/change options = NO and did not specify LO
You must specify the options according to the Db2 syntax rules for utilities. For additional information, restrictions, and recommendations on various utility options, see Db2 online utilities (Db2 12 for z/OS).
Restriction: For LOAD, you cannot specify the DELIMTED option when character conversion is required.Example of Specify Utility Options panel for LOAD:
-
If you requested a work statement list (WSL): On the Specify Work Statement List
(ADB2WLDA) panel, specify the WSL information, and
press Enter.
The utility statements are added to the WSL.
-
If you requested a batch job stream: On the ISPF edit session, change the
generated job as needed or copy it to another it to another data set.
You can use standard ISPF editor commands to manually modify the JCL.
The following figure shows an example of the generated JCL. In this example, the UX option (UNLOAD using REORG UNLOAD EXTERNAL) was chosen on the Tables Utilities (ADB2UT) panel.
-
Make the following changes to the generated utility statements as needed:
- If the utility statement unloads a table and might produce a record length that exceeds 32K, change the utility options so that the record length is less than 32K. (The record length might exceed 32K if the table has LOB objects.) Db2 Admin Tool requires that the record length be less than 32K when unloading tables.
- If you specified UX and Generate work statement list = YES, add a TEMPLATE utility statement to the WSL. The generated REORG statement references a DD name but does not include a template for it.
- Submit the utility job or run the WSL.