Copying data from a VSAM or QSAM file

To copy data to a Db2® table or view from a QSAM or VSAM data set, use the Import utility function (3.6).
Note:
  1. To copy data between Db2® tables, use the Copy utility function (3.3).
  2. To copy data from a Db2® table or view to a QSAM or VSAM data set, use the Export utility function 3.7).
The input to the Import utility function can be a QSAM or VSAM data set produced by:
  • The FM/Db2 Export utility
  • Any external source

You must specify a copybook or template that describes the record format of the data in the input QSAM or VSAM data set. If you specify a copybook, FM/Db2 compiles it to produce a template.

When you copy data to a Db2® table or view from a QSAM or VSAM data set, you can:
  • Reformat data during import by mapping Db2® table columns to fields in the input QSAM or VSAM data set (as defined by a copybook or template).
  • Use a REXX procedure to enhance the way in which data is selected and imported.
  • Specify the number of rows to be imported, and the starting record in the import file.
  • Specify whether you want to run the import in foreground or batch.
  • Specify that any duplicate rows are to be updated with the values in the imported row.
  • Specify how often FM/Db2 should commit changes to Db2® during the import process.

The main panel for the Import utility is the Import Utility ("From") panel.

To display the Copy Utility ("From") panel,

  1. From the Primary Option Menu panel, enter 3 (Utilities) to display the Utility Functions panel.
  2. From the Utility Functions panel, enter 6 (Import)
You can now specify details about:
  • The source QSAM or VSAM data set (where the data is that you want to copy). During this step, you can also edit the source template to restrict the data that is copied (if applicable).
  • The target table (where you want the data copied). During this step, you can also:
    • Edit the template mapping for the target table
    • Specify if you want the copy performed in a batch job
    • Optionally specify the name of a REXX procedure to further enhance the way data is selected