Unloading the existing database
Unload the existing target database by using the HD Reorganization Unload utility with the MIGRATX=YES control statement. The MIGRATX=YES control statement creates unload files for the secondary indexes in addition to the unload file for the indexed database.
When you unload the database by using the MIGRATX=YES control statement, the HD Reorganization Unload utility does not read the secondary indexes. DD statements for the secondary index data sets are not required. The information that is needed to create secondary index entries is generated from the source segments. The unload files for secondary indexes must be sorted before they are used to load the secondary indexes. The output of the HD Reorganization Unload utility includes sort control statements for sorting the unload files of the secondary indexes.
The MIGRATX=YES control statement technique does not preserve any user data in the secondary indexes, which is rarely a problem. Most installations do not maintain user data in secondary indexes because user data is lost every time a reorganization of a non-HALDB database requires the rebuilding of its secondary indexes.
The following figure illustrates a use of the HD Reorganization Unload utility with the MIGRATX=YES control statement to migrate a database and its two secondary indexes.

If you use OSAM database data sets, you can improve the performance of the unload process by using OSAM sequential buffering.
The SYSPRINT listing of the HD Reorganization Unload utility includes a Work File Statistics report. The HD Reorganization Unload utility assigns a name, such as DFSWORK1 or DFSWORK2, to the output file for each secondary index. The Work File Statistics report lists the output file name, the sort file name, and other data associated with each secondary index on a single row in the report. This report maps each output file to each secondary index. You must use the report to understand this relationship. The utility assigns the name DFSWRK01 to the first secondary index relationship it encounters in during the unload process. The report also lists the number of segments in the secondary index files and the sort field sizes and offsets. The following example shows a sample report in which the work file DFSWRK01 contains the records for secondary index STUNUM, and the work file DFSWRK02 contains the records for secondary index STUCRT.
W O R K F I L E S T A T I S T I C S
SINAME WFNAME SFNAME RCDTOTAL OFFSET LENGTH
STUNUM DFSWRK01 DFSSRT01 000087012 0124 0006
STUCRT DFSWRK02 DFSSRT02 000010702 0124 0010