Ways that you can use the EXPORT primary command

Here are two ways you can use the EXPORT primary command:

  • To export data from an arbitrary SQL statement to an external file:
    1. Develop the SQL SELECT statement using options 4.1, 4.2, 4.3, or 4.4. The SQL statement can be any valid SQL statement, including joins of multiple tables, sub-selects, and so on.
    2. Use the row count field to limit the rows loaded into the FM/Db2 editor, if the result table is large.
    3. Confirm that the result table is correct by examining the data in the Edit session.
    4. Optionally edit the template and de-select any columns of the result table that are not required.
    5. Issue the EXPORT command without the ALL parameter, to export all rows from the result table of the arbitrary SQL statement to an external file. You can also issue EXPORT BAT to generate a JCL deck to export the rows from the arbitrary SQL statement to an external file. If required you can take a copy of the generated JCL for later re-use.
  • To export selected editor session rows to an external file:
    1. Ensure that the Use edit (instead of browse) to display results option is selected. This option is set using the FM/Db2 System Options (2 of 3) panel.
    2. Develop the SQL SELECT statement using options 4.1, 4.2, 4.3 or 4.4, or edit the required Db2® object using the FM/Db2 Edit utility.
    3. Use editor commands to isolate the required data in either excluded, not excluded rows, label ranges, or some combination of these methods.
    4. Issue the EXPORT primary command with the OPT parameter and one of ALL, X, or NX. Ensure that the required data format is selected. On the Export "To" panel, enter the required export data set name and set the disposition option to MOD.
    5. After the initial export of rows to the export data set, isolate additional rows to be exported, then issue EXPORT QUIET plus a combination of ALL, X, or NX and optionally a label range, to export the additional rows. The MOD setting for the export file ensures that each additional EXPORT primary command adds the newly-exported rows to the end of the export data set.