Changing Data Source Structure: The REORG Subcommand

How to:

The REORG subcommand enables you to make a variety of changes to the Master File after data has been entered in the FOCUS data source. REBUILD REORG is a two-step procedure that first dumps the data into a temporary workspace and then reloads it under a new Master File.

You can use REBUILD REORG to:

REBUILD REORG will not enable you to:

Procedure: How to Use the REORG Subcommand

The following steps describe how to use the REORG subcommand:

  1. Before making any changes to the original Master File, make a copy of it with another name.
  2. Using an editor, make the desired edits to the copy of the Master File.
  3. Initiate the REBUILD facility by entering:
    REBUILD

    The following options are available:

    1. REBUILD        (Optimize the database structure)
    2. REORG          (Alter the database structure)
    3. INDEX          (Build/modify the database index)
    4. EXTERNAL INDEX (Build/modify an external index database)
    5. CHECK          (Check the database structure)
    6. TIMESTAMP      (Change the database timestamp)
    7. DATE NEW       (Convert old date formats to smartdate formats)
    8. MDINDEX        (Build/modify a multidimensional index)
  4. Select the REORG subcommand by entering:
    REORG or 2

    The options are:

    1. DUMP           (DUMP contents of the database)
    2. LOAD           (LOAD data into the database)
  5. Initiate the DUMP phase of the procedure by entering:
    DUMP or 1
  6. Enter the name of the data source you wish to dump from. Be sure to use the name of the original Master File for this phase.

    On z/OS, enter the ddname.

    On UNIX, Windows, and OpenVMS, enter filename. The data source to be rebuilt will be referenced by a USE command. If no USE command is in effect, the data source will be searched for using the EDAPATH variable.

  7. You can specify selection tests by entering YES. Only data that meets your specifications will be dumped. It is more likely, however, that you will want to dump the entire data source. To do so, enter:
    NO

    Statistics appear during the DUMP procedure, including the number of segments dumped and the name and statistics for the temporary file used to hold the data.

  8. After the DUMP phase is complete, you are ready to begin the second phase of REBUILD REORG: LOAD. Enter:
    REBUILD
  9. Select the REORG subcommand by entering:
    REORG or 2

    The options are:

    1. DUMP     (DUMP contents of the database)
    2. LOAD     (LOAD data into the database)
  10. Initiate the LOAD phase of the procedure by entering:
    LOAD or 2
  11. Enter the name of the data source you wish to load from the temporary file created during the dump phase. In most cases, this will be the new data source name.

At this stage, you have loaded the specified data from the original Master File into a new data source with the name you specified. It is important to remember that both the Master File and data source for the original Master File remain. You have three choices:

  • You may want to rename the original Master File and data source to prevent possible confusion.
  • You may rename the new Master File and data source to the original name. As a result, any existing FOCEXECs referencing the original name will run against the new data source.
  • You may delete the original Master File and data source after you verify that the new Master File and data source are correct and complete.

On non-z/OS platforms, if you enter the name of a data source that already exists, (the original Master File) you are prompted that you will be appending data to a preexisting data source and asked if you wish to continue.

In z/OS, you are not asked if you want to append to an existing data source. The data source is created. If you want to append, when you issue the LOAD command, enter LOAD NOCREATE.

Enter N to terminate REBUILD execution. Enter Y to add the records in the temporary REBUILD file to the original FOCUS data source.

If duplicate field names occur in a Master File, REBUILD REORG is not supported.

In z/OS, you must issue either an allocation or a CREATE for a new data source being loaded.

Example: Using the REORG Subcommand in Windows

The following procedure:

1.  COPY EMPLOYEE.FOC EMPOLD.FOC 
2.  REBUILD 
3.  REORG 
4.  DUMP 
5.  EMPLOYEE 
6.  NO 
7.  ERASE EMPLOYEE.FOC 
8.  REBUILD 
9.  REORG 
10. LOAD 
11. EMPLOYEE
  1. Makes a copy of the data source.
  2. Initiates the REBUILD facility.
  3. Specifies the REORG subcommand.
  4. Initiates the DUMP phase.
  5. Specifies the name of the data source to dump.
  6. Indicates that no record selection tests are required.

    The data source will be dumped and the appropriate statistics will be generated.

  7. Erases the EMPLOYEE data source.
  8. Initiates the REBUILD facility.
  9. Specifies the REORG subcommand.
  10. Initiates the LOAD phase.
  11. Specifies the name of the data source to load.

    The data source will be loaded and the appropriate statistics will be generated.