UNLOAD (tables)
Use the UNLOAD (tables) utility to unload data into a sequential data set. You can choose to replace any existing data with the new data, or to add the new data to the data already in the data set. The UNLOAD (tables) utility provides the most efficient means of adding large amounts of data to a data set.
- Select the columns to be unloaded by specifying the required columns
in the
From
template - Reformat data during the unload by mapping table columns to fields in the output data set (as defined by a template)
- Create and save a File Manager Base component template that describes the unloaded data
- Select which rows to unload
- Specify the number of rows to be unloaded
To include a PUNCHDDN clause in the generated UNLOAD statement, specify the required template name in PUNCHDDN template name on the second TEMPLATE Options panel.
To include a UNLDDN clause in the generated UNLOAD statement, specify the required template name in UNLDDN template name for the UNLOAD statement on the second TEMPLATE Options panel.
The following description applies if you did not specify the name of a LISTDEF on the Db2® Utilities panel. If you did specify the name of a LISTDEF on the Db2® Utilities panel, see UNLOAD (tables) with LISTDEF specified.
On the UNLOAD Utility (Tables) panel:
- The table name details you entered on the Db2® Utilities panel are copied to the UNLOAD Utility (Tables) panel. If you do not want to unload all of the rows in the source table, specify the number of rows you want to unload in the Unload Count field.
- If you are using a specific template for the source table, specify the name of the template in the From Template entry fields.
- In the Processing Options, specify the template you want FM/Db2 to use for the source table, and whether you want to edit the template before FM/Db2 builds the utility batch job.
- To proceed, press Enter. If you selected the Edit template option, FM/Db2 displays the Column Selection/Edit panel. Use this panel to restrict the data in the source table by:
- Selecting or deselecting specific columns for unloading
- Specifying row selection criteria. FM/Db2 selects only the rows whose contents satisfy the criteria for unloading
For example, the template shown in Column Selection/Edit panel showing row selection criteria and selected columns has been edited to select certain columns and only rows whose contents meet certain criteria. If you use this template as theFrom
template for an unload, the data unloaded is restricted to:- The columns FIRSTNME, LASTNAME, WORKDEPT, and JOB, but only where
WORKDEPT equals
MNT
and JOB equalsPAINTER
.
If you did not select the Edit template option (or have completed the edit of the template option), and the value of the UNLDDN template name field on the TEMPLATE Options (2 of 2) panel is blank, FM/Db2 displays the UNLOAD UtilityTo
panel.Note: If the UNLDDN template name field is not blank, FM/Db2 does not display the UNLOAD UtilityTo
panel as the output is already defined. - To temporarily change the settings for the UNLOAD options that
FM/Db2 uses in building the current batch
job, select Edit UNLOAD utility options to display the UNLOAD Options panel.
If you change any of the original settings, they remain in effect only for as long as you use the Db2® Utilities UNLOAD feature in which the settings were changed. If you exit from the UNLOAD Utility (Tables) panel and return to this panel later, the settings changed in the previous UNLOAD session are unavailable.
- On the UNLOAD Utility
To
panel, specify the sequential data set that is the target of the unload by entering theTo
data set details using the Data set name and, optionally, Volume, entry fields. - If you are using a specific template or copybook for the
To
data set, you can specify the name of the template or copybook data set and, optionally, the member name, in the To Data Template or Copybook entry fields.The data format used by the Db2® UNLOAD utility is fixed. Therefore, if you specify a copybook or template data set, the copybook or template should reflect the Db2® UNLOAD data format to avoid data mismatch problems.
When a template is specified for the Db2® unload data set, it must be a File Manager Base component template; a FM/Db2 template cannot be used.
When the Allow padding option on the Db2® UNLOAD utility options panel is not selected, FM/Db2 cannot generate a template that describes the unloaded data. In this situation, all fields related to template processing are protected when the UNLOAD utility
To
panel is displayed and the template usage option is set to 5 (NONE). - Select the Template usage and Disposition options you want.
- You can review the Db2® UNLOAD options by selecting
the View UNLOAD options field. No changes can be made when
the Db2® UNLOAD utility options
panel is displayed. To make changes return to the Db2® UNLOAD utility
From
panel and select Edit UNLOAD options. - To edit the template mapping for the source table, select Edit template mapping to display the Template Mapping panel.
- To proceed, press Enter.
FM/Db2 builds a batch job to execute the Db2® UNLOAD utility job using the specified input details.
Sample JCL generated for UNLOAD (Tables) shows an example of the generated JCL for unloading a table object.
Related tasks
- Working with templates
- Editing a template
- Letting FM/Db2 do the mapping
- Setting options for Db2 utilities
Related references