Loading data described by a copybook or template
You can use the LOAD utility to load data in a sequential data set, providing a copybook or template exists that describes the format of the input data.
In this case, you use a series of panels:
- On the LOAD Utility panel, you specify the name of the data set containing the input data, and the name of the target table.
- On the second panel, you specify the
From
copybook or template that describes the input data. - On the third panel, you can specify the
To
template that describes the target table. Alternatively, you can use FM/Db2 to generate a template for the target table using the information in the Db2® catalog.At this stage, you can define the mapping between fields in the input template and fields in the output template.
To load data described by a copybook or template:
- In the entry fields for input data, specify the name of the data set (Data set name), and optionally the name of the member (Member), containing the data to be loaded.
- In the entry fields for the target Db2® table (Table owner, Table name, and optionally Database and Table space), specify the name of the table into which the data is to be loaded. In any of these fields, you can enter either an asterisk (*) to display a selection list, or wildcards.
- Select option 2 (
The data is described by a template or copybook
) - Press Enter. If you have specified a default name for an INDDN clause (in the INDDN template name field on the second TEMPLATE Options panel), FM/Db2 displays an interim panel showing the default name (for example, LODINDDN) in the Template name field for the input data:
FM/Db2 displays a panel where you can specify the input template or copybook.
- Specify the
From
template details. Perform one of these actions:- Specify a copybook or template:
- In the entry fields for the input template or copybook, specify the name of the data set (Data set name), and optionally the name of the member (Member), for the template or copybook that describes the format of the input data.
- Select 1 (Above) for the Template usage option.
- Use the last (previously used) template:
- Select 2 (Previous) for the Template usage option.
- Specify a copybook or template:
- To edit the template for the input data before proceeding to the LOAD utility
To
template panel, select the View template option. You can select this option by entering either a ⁄ or an “A”.Note: The template edit operations have no effect when the template is used to generate Db2® LOAD utility control statements. If you select this option, you cannot update and save changes to the template. - Press Enter.
FM/Db2 displays a panel where you can specify the template for the target Db2® table.
- Specify the
To
template details using a combination of the To Template and Template usage entry fields. You can:- Specify a template that describes the format of the input data:
- Use Data set name, and optionally Member, to specify the template.
- Select 1 (Above).
- Use the last (previously used) template:
- Select 2 (Previous).
- Use FM/Db2 to generate a template using the information in the Db2® catalog:
- Select 3 (Generate from table).
- Use FM/Db2 to generate a template using the information in the Db2® catalog and store the generated
template using the name you specify (if the member already exists,
FM/Db2 replaces it):
- Use Data set name, and optionally Member, to specify the name that you want FM/Db2 to use when storing the generated template.
- Select 4 (Generate/Replace).
- Specify a template that describes the format of the input data:
- To change the options for the current LOAD session, select Edit load utility
options by entering either a ⁄ or an “A”.
FM/Db2 displays the Load Utility Options panel for editing.
Note: Any options you set on this panel apply for the current LOAD session only. When you exit from the LOAD session, the load options revert to the global LOAD options. - To map the columns (or fields) in the “From” template to the columns in the “To” template, select Edit load utility options by entering either a ⁄ or an “A”. FM/Db2 displays the Template Mapping panel.
- Press Enter. FM/Db2 constructs a batch job to run the Db2® LOAD utility job using the input details you have specified. Sample JCL generated for LOAD Utility using data described by a copybook or template (continued in next figure) shows an example of generated JCL for loading a table using data described by a copybook or template.
Related tasks
- Loading data using LOAD utility control statements
- Mapping data
- Selecting options on FM/Db2 panels
- Editing a template
- Db2 LOAD utility options (option 3.L)
- Using an asterisk (*) or a pattern in entry fields
Related references