Rebuilding a Data Source: The REBUILD Command

In this section:

How to:

Reference:

You can make a structural change to a FOCUS data source after it has been created using the REBUILD command. Using REBUILD and one of its subcommands REBUILD, REORG, INDEX, EXTERNAL INDEX, CHECK, TIMESTAMP, DATE NEW, and MDINDEX, you can:

You can use the REBUILD facility:

Before using the REBUILD facility, you should be aware of several required and recommended prerequisites regarding file allocation, security authorization, and backup.

Reference: Before You Use REBUILD: Prerequisites

Before you use the REBUILD facility, there are several prerequisites that you must consider:

  • Partitioning. You can only REBUILD one partition of a partitioned FOCUS data source at one time. You must explicitly allocate the partition you want to REBUILD. Alternatively, you can create separate Master Files for each partition.
  • Size. To REBUILD a FOCUS data source that is larger than one-gigabyte you must explicitly allocate ddname REBUILD to a temporary file with enough space to contain the data. It is strongly recommended that you REBUILD/REORG to a new file, in sections, to avoid the need to allocate large amounts of space to REBUILD. In the DUMP phase, use selection criteria to dump a section of the data source. In the LOAD phase, make sure to add each new section after the first. To add to a data source you must issue the LOAD command with the following syntax:
    LOAD NOCREATE
  • Allocation. Usually, you do not have to allocate workspace prior to using a REBUILD command. It is automatically allocated. However, adequate workspace must be available. As a rule of thumb, have space 10 to 20% larger than the size of the existing file available for the REBUILD and REORG options.

    The file name REBUILD is always assigned to the workspace. In the DUMP phase of the REORG command, the allocation statement appears in case you want to perform the LOAD phase at a different time.

  • Security authorization. If the data source you are rebuilding is protected by a database administrator, you must be authorized for read and write access in order to perform any REBUILD activity.
  • Backup. Although it is not a requirement, we recommend that you create a backup copy of the original Master File and data source before using any of the REBUILD subcommands.

Procedure: How to Use the REBUILD Facility

The following steps describe how to use the REBUILD facility:

  1. Initiate the REBUILD facility by entering:
    REBUILD
  2. Select a subcommand by supplying its name or its number. The following list shows the subcommand names and their corresponding numbers:
    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 smart date formats)
    8. MDINDEX        (Build/modify a multidimensional index)

Your subsequent responses depend on the subcommand you select. Generally, you will only need to give the name of the data source and possibly one or two other items of information.

If you are using the REBUILD facility interactively, you must allocate SYSPRINT to the terminal in order to view the menu. For more information on using SYSPRINT, see the Overview and Operating Environments manual.

Note: If you select the wrong subcommand interactively, you can enter QUIT to exit.

Controlling the Frequency of REBUILD Messages

How to:

When REBUILD processes a data source, it displays status messages periodically (for example, REFERENCE..AT SEGMENT 1000) to inform you of the progress of the rebuild. The default display interval is every 1000 segment instances processed during REBUILD retrieval and load phases. The number of messages that appear is determined by the number of segment instances in the FOCUS data source being rebuilt, divided by the display interval.

Syntax: How to Control the Frequency of REBUILD Messages

REBUILD displays a message (REFERENCE..AT SEGMENT segnum) at periodic intervals to inform you of its progress as it processes a data source. You can control the frequency with which REBUILD displays this message by issuing the command

SET REBUILDMSG = {n|1000}

where:

n

Is any integer from 1,000 to 99,999,999 or 0 (to disable the messages).

A setting of less than 1000:

  • Generates a warning message that describes the valid values (0 or greater than 999).
  • Keeps the current setting. The current setting will either be the default of 1000, or the last valid integer greater than 999 to which REBUILDMSG was set.

Example: Controlling the Display of REBUILD Messages

The following messages are generated for a REBUILD CHECK where REBUILDMSG has been set to 4000, and the data source contains 19,753 records.

STARTING..
REFERENCE..AT SEGMENT    4000
REFERENCE..AT SEGMENT    8000
REFERENCE..AT SEGMENT   12000
REFERENCE..AT SEGMENT   16000
NUMBER OF SEGMENTS RETRIEVED=   19753
CHECK COMPLETED...

Information Builders