Syntax and options of the REORG INDEX control statement

The REORG INDEX utility control statement, with its multiple options, defines the function that the utility job performs.

You can create a control statement with the ISPF/PDF edit function. After creating it, save it in a sequential or partitioned data set. When you create the JCL for running the job, use the SYSIN DD statement to specify the name of the data set that contains the utility control statement.

Start of change

Syntax diagram

Read syntax diagramSkip visual syntax diagram REORG INDEXLISTlistdef-nameindex-name-specREUSECLONESHRLEVELNONESHRLEVELREFERENCEdeadline-specdrain-specSHRLEVELCHANGEdeadline-specdrain-specchange-specFASTSWITCHYESFASTSWITCHNOFORCENONEFORCEREADERSALLLEAFDISTLIMITintegerREPORTONLYUNLOADCONTINUEUNLOADPAUSE1ONLYstats-spec2SORTDEVTdevice-typeSORTNUMintegerWORKDDN(SYSUT1)WORKDDN( ddname)PREFORMATFLASHCOPYNOFLASHCOPYYESCONSISTENTFCCOPYDDN( template-name)RBALRSN_CONVERSIONEXTENDEDRBALRSN_CONVERSIONNONENOSYSUT1PARALLEL0PARALLELnum-subtasks
index-name-spec
Read syntax diagramSkip visual syntax diagramINDEXcreator-id.index-nameINDEXSPACEdatabase-name.index-space-namePARTinteger
deadline-spec
Read syntax diagramSkip visual syntax diagramDEADLINENONEDEADLINEtimestamplabeled-duration-expression
labeled-duration-expression
Read syntax diagramSkip visual syntax diagramCURRENT_DATECURRENT_TIMESTAMPWITH TIME ZONE +  - constantYEARYEARSMONTHMONTHSDAYDAYSHOURHOURSMINUTEMINUTESSECONDSECONDSMICROSECONDMICROSECONDS
drain-spec
Read syntax diagramSkip visual syntax diagramDRAIN_WAITIRLMRWT-valueDRAIN_WAITintegerRETRYUTIMOUT-valueRETRYintegerRETRY_DELAYcalculated-defaultRETRY_DELAYintegerTIMEOUTTERMTIMEOUTABEND
change-spec
Read syntax diagramSkip visual syntax diagramMAXRORETRY_DELAY-default-valueMAXROintegerDEFERDRAINALLDRAINWRITERSLONGLOGCONTINUELONGLOGTERMDRAINDELAY1200DELAYintegerLOGRANGESYESLOGRANGESNOLASTLOGYESLASTLOGNOSWITCHTIMENONESWITCHTIMEtimestamplabeled-duration-expressionNEWMAXRONONENEWMAXROinteger
stats-spec
Read syntax diagramSkip visual syntax diagram STATISTICS REPORTNOREPORTYEScorrelation-stats-specUPDATEALLUPDATEACCESSPATHSPACE NONEINVALIDATECACHENOINVALIDATECACHEYESHISTORYALLACCESSPATHSPACE NONEFORCEROLLUPYESNO
correlation-stats-spec
Read syntax diagramSkip visual syntax diagramKEYCARD3FREQVALNUMCOLS1COUNT10FREQVALNUMCOLSintegerCOUNTinteger4MOSTBOTHLEASTHISTOGRAMNUMCOLS1NUMQUANTILES100NUMCOLSintegerNUMQUANTILES100NUMQUANTILESinteger
Notes:
  • 1 You cannot use UNLOAD PAUSE with the LIST option.
  • 2 You cannot specify any options in stats-spec with the UNLOAD ONLY option.
  • 3 The KEYCARD option is deprecated. The functionality previously controlled by KEYCARD is incorporated into the default processing of inline statistics during the execution of REBUILD INDEX STATISTICS and cannot be disabled.
  • 4 When the COUNT keyword is not specified, the utility automatically determines the count value and collects the most frequently occurring values.
End of change

Option descriptions

INDEX creator-id.index-name
Specifies an index that is to be reorganized.

creator-id. specifies the creator of the index and is optional. If you omit the qualifier creator ID, Db2 uses the user identifier for the utility job. index-name is the qualified name of the index to copy. For an index, you can specify either an index name or an index space name. Enclose the index name in quotation marks if the name contains a blank.

INDEXSPACE database-name.index-space-name
Specifies the qualified name of the index space that is obtained from the SYSIBM.SYSINDEXES table.

database-name specifies the name of the database that is associated with the index and is optional.

The default value is DSNDB04.

index-space-name specifies the qualified name of the index space that is to be reorganized; the name is obtained from the SYSIBM.SYSINDEXES table.

LIST listdef-name
Specifies the name of a previously defined LISTDEF list name. The INDEX keyword is required to differentiate this REORG INDEX LIST from REORG TABLESPACE LIST. The utility allows one LIST keyword for each control statement of REORG INDEX. The list must not contain any table spaces. REORG INDEX is invoked once for each item in the list. This utility will only process clone data if the CLONE keyword is specified. The use of CLONED YES on the LISTDEF statement is not sufficient.

Do not specify STATISTICS INDEX index-name with REORG INDEX LIST. If you want to collect inline statistics for a list of indexes, just specify STATISTICS.

You cannot specify DSNUM and PART with LIST on any utility.

The partitions or partition ranges can be specified in a list.

PART integer
Identifies a partition that is to be reorganized. You can reorganize a single partition of a partitioning index. You cannot specify PART with LIST. integer is the physical partition number. It must be in the range from 1 to the number of partitions that are defined for the partitioning index. The maximum value is 4096.

integer designates a single partition.

If you omit the PART keyword, the entire index is reorganized.

REUSE
When used with SHRLEVEL NONE, specifies that REORG is to logically reset and reuse DB2®-managed data sets without deleting and redefining them. If you do not specify REUSE and SHRLEVEL NONE, Db2 deletes and redefines Db2-managed data sets to reset them.

If a data set has multiple extents and you use the REUSE parameter, the extents are not released.

If you specify SHRLEVEL REFERENCE or CHANGE with REUSE, REUSE does not apply

CLONE
Indicates that REORG INDEX is to reorganize only the specified index spaces and indexes that are defined on clone tables. This utility will only process clone data if the CLONE keyword is specified. The use of CLONED YES on the LISTDEF statement is not sufficient.
SHRLEVEL
Specifies the method for performing the reorganization. The parameter following SHRLEVEL indicates the type of access that is to be allowed during the RELOAD phase of REORG.
NONE
Specifies that reorganization is to operate by unloading from the area that is being reorganized (while applications can read but cannot write to the area), building into that area (while applications have no access), and then allowing read-write access again.

If you specify NONE (explicitly or by default), you cannot specify the following parameters:

  • MAXRO
  • LONGLOG
  • DELAY
  • DEADLINE
  • DRAIN_WAIT
  • RETRY
  • RETRY_DELAY
REFERENCE
Specifies that reorganization is to operate as follows:
  • Unload from the area that is being reorganized while applications can read but cannot write to the area.
  • Build into a shadow copy of that area while applications can read but cannot write to the original copy.
  • Switch the future access of the applications from the original copy to the shadow copy by exchanging the names of the data sets, and then allowing read-write access again.

If you specify REFERENCE, you cannot specify the following parameters:

  • UNLOAD (Reorganization with REFERENCE always performs UNLOAD CONTINUE.)
  • MAXRO
  • LONGLOG
  • DELAY
CHANGE
Specifies that reorganization is to operate as follows:
  • Unload from the area that is being reorganized while applications can read and write to the area.
  • Build into a shadow copy of that area while applications can read and write to the original copy.
  • Apply the log of the original copy to the shadow copy while applications can read and usually write to the original copy.
  • Switch the future access of the applications from the original copy to the shadow copy by exchanging the names of the data sets, and then allowing read-write access again.

If you specify CHANGE, you cannot specify the UNLOAD parameter. Reorganization with CHANGE always performs UNLOAD CONTINUE.

SHRLEVEL CHANGE cannot be specified if the table space has the NOT LOGGED attribute.

DEADLINE
Specifies the deadline for the SWITCH phase to begin. If Db2 estimates that the SWITCH phase does not begin by the deadline, Db2 issues the messages that the DISPLAY UTILITY command issues and then terminates reorganization.

The final result and all the timestamp calculation of DEADLINE will be in TIMESTAMP(6).

NONE
Specifies that no deadline exists by which the switch phase of log processing must begin.
timestamp
Specifies the deadline for the switch phase of log processing to begin. This deadline must not have already occurred when REORG is executed.
labeled-duration-expression
Calculates the deadline for the switch phase of log processing to begin. The calculation is based on either CURRENT TIMESTAMP or CURRENT DATE. You can add or subtract one or more constant values to specify the deadline. This deadline must not have already occurred when REORG is executed. CURRENT TIMESTAMP and CURRENT DATE are evaluated once, when the REORG statement is first processed. If a list of objects is specified, the same value will be in effect for all objects in the list.
CURRENT_DATE
Specifies that the deadline is to be calculated based on the CURRENT DATE.
CURRENT_TIMESTAMP
Specifies that the deadline is to be calculated based on the CURRENT TIMESTAMP.
WITH TIME ZONE
Specifies that the CURRENT TIMESTAMP is compared with the time zone column. The timestamp precision of the special register CURRENT TIMESTAMP should be the same as the column timestamp precision. Otherwise the default timestamp precision is used. The time zone of CURRENT TIMESTAMP is the value of special register CURRENT TIMEZONE. The comparison is done by comparing the UTC portion of the timestamp.
constant
Indicates a unit of time and is followed by one of the seven duration keywords: YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, or MICROSECONDS. The singular form of these words is also acceptable: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MICROSECOND.

If REORG SHRLEVEL REFERENCE or SHRLEVEL CHANGE terminates because of a DEADLINE specification, Db2 issues message DSNU374I with reason code 2 but does not set a restrictive status.

DRAIN_WAIT integer
Specifies the number of seconds that the utility waits when draining for SQL statements (inserts, updates, deletes, and selects). The specified time is the aggregate time for all partitions of the index that is to be reorganized. This value overrides the values specified by IRLMRWT and UTIMOUT, for these SQL statements only. For operations like commands, the IRLMRWT and UTIMOUT values are used. Valid values for integer are from 0 to 1800. If the keyword is omitted or if a value of 0 is specified, the utility uses the value of the lock timeout system parameter IRLMRWT.
RETRY integer
Specifies the maximum number of retries that REORG is to attempt. Valid values for integer are from 0 to 255.

Specifying RETRY can lead to increased processing costs and can result in multiple or extended periods of read-only access.

The default value is the value of the UTIMOUT subsystem parameter.

RETRY_DELAY integer
Specifies the minimum duration, in seconds, between retries. Valid values for integer are from 1 to 1800.
If you do not specify RETRY_DELAY, REORG INDEX uses the smaller of the following two values:
  • DRAIN_WAIT value × RETRY value
  • DRAIN_WAIT value × 10
MAXRO integer
Specifies the maximum amount of time for the last iteration of log processing. During that iteration, applications have read-only access.

The actual execution time of the last iteration might exceed the specified MAXRO value.

The ALTER UTILITY command can change the value of MAXRO.

The default value is the RETRY_DELAY default value.

integer
integer is the number of seconds. Specifying a small positive value reduces the length of the period of read-only access, but it might increase the elapsed time for REORG to complete. If you specify a huge positive value, the second iteration of log processing is probably the last iteration.

The default value is 300 seconds.

DEFER
Specifies that the iterations of log processing with read-write access can continue indefinitely. REORG never begins the final iteration with read-only access, unless you change the MAXRO value by using the ALTER UTILITY command.

If you specify DEFER, you should also specify LONGLOG CONTINUE.

If you specify DEFER, and Db2 determines that the actual time for an iteration and the estimated time for the next iteration are both less than 5 seconds, Db2 adds a 5-second pause to the next iteration. This pause reduces consumption of processor time. The first time this situation occurs for a given execution of REORG, Db2 sends message DSNU362I to the console. The message states that the number of log records that must be processed is small and that the pause occurs. To change the MAXRO value and thus cause REORG to finish, execute the ALTER UTILITY command. Db2 adds the pause whenever the situation occurs; however, Db2 sends the message only if 30 minutes have elapsed since the last message was sent for a given execution of REORG.

DRAIN
Specifies drain behavior at the end of the log phase after the MAXRO threshold is reached and when the last iteration of the log is to be applied.
WRITERS
Specifies that Db2 drains only the writers during the log phase after the MAXRO threshold is reached and then issues DRAIN ALL on entering the switch phase.
ALL
Specifies the current default action, in which Db2 is to drain all readers and writers during the log phase, after the MAXRO threshold is reached.
Consider specifying DRAIN ALL if the following conditions are both true:
  • SQL update activity is high during the log phase.
  • The default behavior results in a large number of -911 SQL error messages.
LONGLOG
Specifies the action that Db2 is to perform, after sending a message to the console, if the number of records that the next iteration of log process is to process is not sufficiently lower than the number that the previous iterations processed. This situation means that REORG INDEX is not reading the application log quickly enough to keep pace with the writing of the application log.
CONTINUE
Specifies that until the time on the JOB statement expires, Db2 is to continue performing reorganization, including iterations of log processing, if the estimated time to perform an iteration exceeds the time that is specified with MAXRO.

A value of DEFER for MAXRO and a value of CONTINUE for LONGLOG together mean that REORG INDEX is to continue allowing access to the original copy of the area that is being reorganized and does not switch to the shadow copy. The user can execute the ALTER UTILITY command with a large value for MAXRO when the switching is wanted.

TERM
Specifies that Db2 is to terminate reorganization after the delay specified by the DELAY parameter.
DRAIN
Specifies that Db2 is to drain the write claim class after the delay that is specified by the DELAY parameter. This action forces the final iteration of log processing to occur.
DELAY integer
Specifies the minimum interval between the time that REORG sends the LONGLOG message to the console and the time REORG that performs the action that is specified by the LONGLOG parameter.

integer is the number of seconds.

The default value is 1200.

TIMEOUT
Specifies the action that is to be taken if the REORG INDEX utility gets a timeout condition while trying to drain objects in either the log or switch phases.
TERM
Indicates that Db2 is to behave as follows if you specify the TERM option and a time out condition occurs:
  1. Db2 issues an implicit TERM UTILITY command, causing the utility to end with a return code 8.
  2. Db2 issues the DSNU590I and DSNU170I messages.
  3. Db2 leaves the objects in a RW state.
ABEND
Indicates that if a timeout condition occurs, Db2 is to leave the objects in a UTRO or UTUT state.
LOGRANGES
Specifies whether REORG is to use SYSLGRNX information for the LOG phase.
YES
REORG uses SYSLGRNX information for the LOG phase whenever possible. This option is the default behavior.
NO
REORG does not use SYSLGRNX information for the LOG phase. This option can cause REORG to run much longer. In a data sharing environment this option can result in the merging of all logs from all members. This option is feasible when there is a known integrity issue with SYSLGRNX entries and performance problems in accessing SYSLGRNX for log read determination.
Start of changeLASTLOGEnd of change
Start of changeSpecifies whether REORG SHRLEVEL CHANGE is to apply any log records during the final log iteration in the LOG phase.

Specifying LASTLOG NO can help reduce outage time by avoiding the costly sub processes (such as page sets force write) that occur in the final log iteration; however, LASTLOG NO might cause REORG to not complete if it cannot find the required period of time without concurrent DML activities. LASTLOG NO requires the DRAIN ALL option to be in effect.

LASTLOG is ignored for REORG executions without SHRLEVEL CHANGE processing.

YES
Specifies that REORG is to perform one final round of log apply processing after draining all claim classes (DRAIN ALL). Specifying YES ensures that REORG proceeds to the SWITCH phase after completing the final round of log apply processing in the LOG phase.

YES is the default value.

NO
Specifies that REORG is not to apply any log records in the final log iteration. When existing criteria is met for REORG to "break in" (gain control of objects), REORG firsts drains all claim classes and then processes the logs from the end of the last log iteration to current. If any log records of the target objects are found in this final log iteration, REORG dedrains the target objects and reverts this final log iteration back to a normal log iteration. When REORG "breaks in" again in a future log iteration, the utility repeats this cycle of drain all, log read, and dedrain until it can complete the final log iteration with no log records to apply. The reversion back to a normal log iteration due to the presence of logs counts as a drain failure for RETRY consideration; therefore a high RETRY value is recommended to lessen the impact of the repeating "break in" attempts.
End of change
SWITCHTIME
Specifies the time for the final log iteration of the LOG phase to begin. The final result and all of the time stamp calculations of SWITCHTIME are in TIMESTAMP(6). This keyword can be specified with the MAXRO keyword. If MAXRO DEFER is not specified, REORG enters the final log iteration of the LOG phase before the specified SWITCHTIME value if the specified or defaulted MAXRO criteria is met. When MAXRO DEFER is specified, REORG does not attempt to enterto the final log iteration until the specified SWITCHTIME is met or affected by an external ALTER UTILITY command in the changing of its MAXRO value.
NONE
Does not specify a time for the final log iteration of the LOG phase. This option is the default behavior.
timestamp
Specifies the time that the final log iteration of the LOG phase is to begin. This time must not have already occurred when REORG is run.
labeled-duration-expression
Calculates the time for the final log iteration of LOG phase is to begin. The calculation is based on either CURRENT TIMESTAMP or CURRENT DATE. You can add or subtract one or more constant values to specify the switch time. This switch time must not have already occurred when REORG is run. CURRENT TIMESTAMP and CURRENT DATE are evaluated once, when the REORG statement is first processed. If a list of objects is specified, the same value is in effect for all objects in the list.
CURRENT_DATE
Specifies that the deadline is to be calculated based on the CURRENT DATE.
CURRENT_TIMESTAMP
Specifies that the deadline is to be calculated based on the CURRENT TIMESTAMP.
WITH TIME ZONE
Specifies that the CURRENT TIMESTAMP is compared with the time zone column. The time stamp precision of the special register CURRENT TIMESTAMP should be the same as the column time stamp precision. Otherwise, the default time stamp precision is used. The time zone of CURRENT TIMESTAMP is the value of special register CURRENT TIMEZONE. The comparison is done by comparing the Coordinated Universal Time portion of the time stamp.
constant
Indicates a unit of time and is followed by one of the seven duration keywords: YEARS, MONTHS, DAYS, HOURS, MINUTES, SECONDS, or MICROSECONDS. The singular form of these words is also acceptable: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MICROSECOND.
NEWMAXRO
Specifies the maximum amount of time for the last log iteration after SWITCHTIME is met. The SWITCHTIME keyword must also be specified. This value overrides the existing MAXRO parameter that is specified. The default is NONE.
NONE
Specifies that when the specified SWITCHTIME is met, REORG proceeds to the last log iteration without taking log processing time in to consideration. Specifying NONE results in REORG entering the last log iteration almost immediately at or after the specified SWITCHTIME. This option is the default.
integer
integer is the number of seconds. Specifying a small positive value reduces the length of the period of read-only access, but it might increase the elapsed time for REORG to complete. Specifying a large positive value probably ensures that REORG will enter the last log iteration almost immediately at or after the specified SWITCHTIME.
FORCE
Specifies the action to be taken when the utility is draining the table space.

When REORG FORCE is canceling the threads, it performs a soft cancel similar to the cancel that the CANCEL THREAD does.

NONE
Specifies that no action is taken when REORG performs drain. The REORG utility waits for the claimers to commit. The utility will timeout or restart when the drain fails, as determined by existing conditions.
READERS
Specifies that read claimers are canceled when REORG is requesting a drain all on the last RETRY processing.
ALL
specifies that both read and write claimers are canceled when REORG is requesting a drain all or drain writers on the last RETRY processing.
FASTSWITCH
Specifies which switch methodology is to be used for a reorganization.
YES
Enables the SWITCH phase to use the FASTSWITCH methodology. This option is not allowed for the catalog (DSNDB06) or directory (DSNDB01).
NO
Causes the SWITCH phase to use IDCAMS RENAME.
LEAFDISTLIMIT integer

The LEAFDISTLIMIT option is deprecated, and the alternative is running DSNACCOX.

Specifies that the value for integer is to be compared to the LEAFDIST value for the specified partitions of the specified index in SYSIBM.SYSINDEXPART. If any LEAFDIST value exceeds the specified LEAFDISTLIMIT value, REORG is performed or, if you specify REPORTONLY, recommended.

The default value is 200.

Because a node ID index , auxiliary index, hash index, or XML index has a LEAFDIST value of -2, REORG is not performed for any of those indexes when LEAFDISTLIMIT is specified.

REPORTONLY

The REPORTONLY option is deprecated, and the alternative is running DSNACCOX.

Specifies that REORG is only to be recommended, not performed. REORG produces a report with one of the following return codes:
1
No limit met; no REORG performed or recommended.
2
REORG performed or recommended.
UNLOAD
Specifies whether the utility job is to continue processing or terminate after the data is unloaded.
CONTINUE
Specifies that, after the data has been unloaded, the utility is to continue processing.
PAUSE

The UNLOAD PAUSE option has been deprecated. If you need to stop the utility after the keys are unloaded, use DIAGNOSE in combination with the REORG utility to stop the process (pause).

Specifies that, after the data has been unloaded, processing is to end. The utility stops and the RELOAD status is stored in SYSIBM.SYSUTIL so that processing can be restarted with RELOAD RESTART(PHASE).

This option is useful if you want to redefine data sets during reorganization. For example, with a user-defined data set, you can:

  • Run REORG with the UNLOAD PAUSE option.
  • Redefine the data set using Access Method Services.
  • Restart REORG by resubmitting the previous job and specifying RESTART(PHASE).

If no records are unloaded during an UNLOAD PAUSE, when REORG is restarted, the RELOAD and BUILD phases are bypassed.

You cannot use UNLOAD PAUSE if you specify the LIST option.

ONLY

The UNLOAD ONLY option has been deprecated. If you need to unload the keys, use DIAGNOSE in combination with the REORG utility to stop the process after the keys are unloaded, and TERM UTIL to terminate the utility.

Specifies that, after the data has been unloaded, the utility job ends and the status in SYSIBM.SYSUTIL that corresponds to this utility ID is removed.
STATISTICS
Specifies that statistics for the index are to be collected; the statistics are either reported or stored in the Db2 catalog. You cannot collect inline statistics for indexes on the catalog and directory tables.
Restrictions:
  • If you specify STATISTICS for encrypted data, Db2 might not provide useful information on this data.
  • You cannot specify STATISTICS for clone objects.

If pending definition changes are materialized during REORG INDEX with SHRLEVEL REFERENCE or SHRLEVEL CHANGE, index statistics are collected and updated in the Db2 catalog by default.

If the STATISTICS keyword was not specified in the REORG INDEX with SHRLEVEL REFERENCE or CHANGE statement when pending definition changes are materialized, the following keywords are run by default: STATISTICS UPDATE ALL HISTORY ALL. If you also specify the STATISTICS keyword in the REORG INDEX with the SHRLEVEL REFERENCE or SHRLEVEL CHANGE statement when pending definition changes are materialized, the options specified overwrite the default options.

Recommendation: Some partition statistics can become obsolete due to the materialization of pending definition changes. The partition statistics that can become obsolete are COLGROUP statistics, statistics for key column values in indexes, HISTOGRAM statistics, frequency statistics with NUMCOLS > 1, and statistics for extended indexes where applicable. Run the RUNSTATS utility to collect the partition statistics again.
REPORT
Indicates whether a set of messages to report the collected statistics is to be generated.
NO
Indicates that the set of messages is not to be sent as output to SYSPRINT.
YES
Indicates that the set of messages is to be sent as output to SYSPRINT. The generated messages are dependent on the combination of keywords (such as TABLESPACE, INDEX, TABLE, and COLUMN) that you specify with the RUNSTATS utility. However, these messages are not dependent on the specification of the UPDATE option. REPORT YES always generates a report of SPACE and ACCESSPATH statistics.
KEYCARD
The KEYCARD option is deprecated in the utility control statement and no longer needs to be specified to collect cardinality statistics on the values in the key columns of an index.

When the STATISTICS option is specified, the utility automatically collects all of the distinct values in all of the 1 to n key column combinations for the indexes being rebuilt.n is the number of columns in the index. With the deprecation of KEYCARD, this functionality cannot be disabled.

The utility tolerates the specification of the KEYCARD option. The utility does not issue any messages if the control statement includes or excludes the KEYCARD option when STATISTICS is specified.

FREQVAL
Controls the collection of frequent-value statistics. If you specify FREQVAL, it must be followed by the NUMCOLS keyword.
NUMCOLS
Indicates the number of key columns that are to be concatenated when collecting frequent values from the specified index. If you specify 3, the utility collects frequent values on the concatenation of the first three key columns.

The default value is 1, which means that Db2 is to collect frequent values only on the first key column of the index.

COUNT
Indicates the number of frequent values that are to be collected. If you specify 15, the utility collects 15 frequent values from the specified key columns.

Start of changeWhen the COUNT keyword is not specified, the utility automatically determines the count value and collects the most frequently occurring values.End of change

Start of changeMOSTEnd of change
Start of changeIndicates that the utility is to collect the most frequently occurring values for the specified set of columns when COLGROUP is specified.End of change
Start of changeBOTHEnd of change
Start of changeIndicates that the utility is to collect the most and the least frequently occurring values for the specified set of columns when COLGROUP is specified.End of change
Start of changeLEASTEnd of change
Start of changeIndicates that the utility is to collect the least frequently occurring values for the specified set of columns when COLGROUP is specified.End of change
HISTOGRAM
Indicates that histogram statistics are requested for the specified index.
NUMCOLS
The number of key columns that are to be concatenated when collecting histogram statistics from the specified index.
NUMQUANTILES
The integer values that follows NUMQUANTILES indicates the number quantiles are requested. The integer value must be greater than or equal to 1.

Histogram statistics can be collected only on keys with the same order. If the specified key columns for histogram statistics are of mixed or random order, a DSNU633I warning message is issued.

Histogram statistics that you collect through REBUILD INDEX are not the same as histogram statistics that you collect through RUNSTATS. Histogram statistics that you collect with REBUILD INDEX are only rough estimates. To obtain more exact statistics, use RUNSTATS.

Related information:
UPDATE
Indicates whether the collected statistics are to be inserted into the catalog tables. UPDATE also allows you to select statistics that are used for access path selection or statistics that are used by database administrators.
ALL
Indicates that all collected statistics are to be updated in the catalog.
ACCESSPATH
Indicates that the only catalog table columns that are to be updated are those that provide statistics that are used for access path selection.
SPACE
Indicates that the only catalog table columns that are to be updated are those that provide statistics to help the database administrator assess the status of a particular table space or index.
NONE
Indicates that catalog tables are not to be updated with the collected statistics. This option is valid only when REPORT YES is specified.
Start of changeINVALIDATECACHEEnd of change
Start of changeIndicates whether statements in the dynamic statement cache are invalidated as a result of the inline statistics collection. This option does not prevent the utility from invalidating cached statements for other reasons.
YES
Statements in the dynamic cache are invalidated for the objects that are specified in the job statement.
NO
Statements in the dynamic cache are not invalidated by the collection of inline statistics for the objects that are specified in the job statement. However, cached statements might be invalidated by the utility for reasons other than the inline statistics, such as when the utility resolves objects in restricted states or applies pending ALTER operations.
End of change
HISTORY
Records all catalog table inserts or updates to the catalog history tables.

The default is supplied by the value that is specified in STATISTICS HISTORY on panel DSNTIP6.

ALL
Indicates that all collected statistics are to be updated in the catalog history tables.
ACCESSPATH
Indicates that the only catalog history table columns that are to be updated are those that provide statistics that are used for access path selection.
SPACE
Indicates that only space-related catalog statistics are to be updated in catalog history tables.
NONE
Indicates that catalog history tables are not to be updated with the collected statistics.
FORCEROLLUP
Specifies whether aggregation or rollup of statistics is to take place when you execute RUNSTATS even if some indexes or index partitions are empty. This keyword enables the optimizer to select the best access path.

The following options are available for the FORCEROLLUP keyword:

YES
Indicates that forced aggregation or rollup processing is to be done, even though some indexes or index partitions might not contain data.
NO
Indicates that aggregation or rollup is to be done only if data is available for all indexes or index partitions.

If data is not available, the utility issues DSNU623I message if you have set the installation value for STATISTICS ROLLUP on panel DSNTIP6 to NO.

SORTDEVT device-type
Specifies the device type for temporary data sets that are to be dynamically allocated by the external sort program. For device-type, specify any disk device that is valid on the DYNALLOC parameter of the SORT or OPTION options for the sort program. Tape devices are not supported by the sort program.
SORTNUM integer
Specifies the number of temporary data sets that are to be dynamically allocated when collecting statistics for a data-partitioned secondary index. If you omit SORTDEVT, SORTNUM is ignored. If you use SORTDEVT and omit SORTNUM, no value is passed to the sort program; the sort program uses its own default.

integer is the number of temporary data sets that can range from 2 to 255.

REORG INDEX does not sort index keys. Only one sort can be performed, and that is if inline statistics are being collected for a DPSI.

Important: Start of changeThe SORTNUM keyword is ignored if the IGNSORTN subsystem parameter is set to YES.End of change
WORKDDN(ddname)
ddname specifies the DD statement for the unload data set.
ddname
Is the DD name of the temporary work file for build input.

The default value is SYSUT1.

The WORKDDN keyword specifies either a DD name or a TEMPLATE name from a previous TEMPLATE control statement. If utility processing detects that the specified name is both a DD name in the current job step and a TEMPLATE name, the utility uses DD name.

Even though WORKDDN is an optional keyword, a DD statement for the unload output data set is required in the JCL. If you do not specify WORKDDN, or if you specify it without ddname, the JCL must have a DD statement with the name SYSUT1. If ddname is given, you must provide a DD statement or TEMPLATE that matches the DD name.

PREFORMAT
Specifies that the remaining pages are to be preformatted up to the high-allocated RBA in the index space. The preformatting occurs after the index is built.

PREFORMAT can operate on an entire index space, or on a partition of a partitioned index space.

PREFORMAT is ignored if you specify UNLOAD ONLY.

FLASHCOPY
Specifies whether FlashCopy® technology is used to create a copy of the object. Valid values are YES, NO, or CONSISTENT. When FlashCopy is used, a separate data set is created for each partition or piece of the object.

The FlashCopy specifications on the utility control statement override any specifications for FlashCopy that are defined by using the Db2 subsystem parameters. If the FlashCopy subsystem parameters specify the use of FlashCopy as the default behavior of this utility, the FLASHCOPY option can be omitted from the utility control statement.

Important: If the input data set is less than one cylinder, FlashCopy technology might not be used for copying the objects regardless of the FLASHCOPY settings. The copy is performed by IDCAMS if FlashCopy is not used.
NO
Specifies that no FlashCopy is made. NO is the default value for FLASHCOPY.
YES
Specifies that FlashCopy technology is used to copy the object.

Specify YES only if the Db2 data sets are on FlashCopy Version 2 disk volumes.

Important: Under the following circumstances, the REORG INDEX utility might not use FlashCopy even though YES is specified:
  • FlashCopy Version 2 disk volumes are not available
  • The source tracks are already the target of a FlashCopy operation
  • The target tracks are the source of a FlashCopy operation
  • The maximum number of relationships for the copy is exceeded
In the event that FlashCopy is not used, the REORG INDEX utility uses traditional I/O methods to copy the object, which can result in longer than expected execution time.

If SHRLEVEL REFERENCE or SHRLEVEL CHANGE is specified when the copy operation is forced to use traditional I/O methods, an even longer outage might occur, because the FlashCopy image copies are created during the SWITCH phase of utility execution.

Start of changeA warning is issued if any FlashCopy errors are encountered during REORG INDEX processing.End of change

CONSISTENT
Specifies that FlashCopy technology is used to copy the object. Because the copies created by the REORG INDEX utility are already consistent, the utility treats a specification of CONSISTENT the same as a specification of YES.
FCCOPYDDN
Specifies the template to be used to create the FlashCopy image copy data set names. If a value is not specified for FCCOPYDDN on the REORG INDEX control statement when FlashCopy is used, the value specified on the FCCOPYDDN subsystem parameter determines the template to be used.
(template-name)
The data set names for the FlashCopy image copy are allocated according to the template specification. For table space or index space level FlashCopy image copies, because a data set is allocated for each partition or piece, ensure that the data set naming convention in the template specification is unique enough. Use the &DSNUM variable, which resolves to a partition number or piece number at execution time.
Start of change RBALRSN_CONVERSION End of change
Start of changeSpecifies the RBA or LRSN format of the target object after the completion of the REORG utility.
Important: RBALRSN_CONVERSION is deprecated, meaning that its use is discouraged. Although this keyword remains supported, support is likely to be removed eventually. The utility fails if BASIC is specified, or if NONE is specified for an object in the 6-byte format.
EXTENDED
Specifies that if an object is found in basic 6-byte format, it is converted to 10-byte extended format.

EXTENDED is the default value.

NONE
Specifies that no conversion is performed.

The utility fails if RBALRSN_CONVERSION NONE is specified on a table space that is in basic 6-byte format.

If a CLONE relationship exists, the page set conversion cannot be performed. For clone relationships, you must drop the clone table, convert the base table to extended 10-byte format, and then re-create the clone table.

End of change
Start of changeNOSYSUT1End of change
Start of changeSpecifies that REORG INDEX is not to use a work data set (SYSUT1 by default) to hold the unloaded index keys. Instead, the utility passes the unloaded keys in memory as input to the index build for this process. Avoiding usage of the work data set can improve performance.

Specifying NOSYSUT1 also enables REORG INDEX to use parallel subtasks to unload and build the index keys as part of its internal processing. The utility can unload and build the index keys using parallel subtasks concurrently and operate on different physical partitions of the target partitioned index (PI or DPSI) with parallel tasks. REORG INDEX determines the optimal degree of parallelism based on available system resources at run time. The utility starts at least one index unload task and one index build task. If desired, you can limit the degree of parallelism by specifying PARALLEL num-subtasks.

The NOSYSUT1 option is ignored if SHRLEVEL NONE is specified or used by default.

If NOSYSUT1 is specified and an error occurs when unloading or building the index keys, you must perform a phase restart of the utility from the beginning of the UNLOAD phase. This requirement applies only when SHRLEVEL REFERENCE is specified; REORG INDEX with SHRLEVEL CHANGE is not restartable until the SWITCH phase.

End of change
Start of changePARALLEL num-subtasksEnd of change
Start of changeSpecifies the maximum number of subtasks that are to be started in parallel to reorganize the index. If the PARALLEL keyword is omitted, the maximum number of subtasks is limited by the number of indexes or index partitions that are being reorganized. PARALLEL is ignored if REORG INDEX cannot use subtask parallelism for its internal processing.

The value of num-subtasks must be an integer between 0 and 32767, inclusive. If the specified value for num-subtasks is greater than 32767, REORG INDEX fails. If 0 or no value is specified for num-subtasks, REORG INDEX uses the optimal number of parallel subtasks. If the specified value for num-subtasks is greater than the calculated optimal number, REORG INDEX limits the number of parallel subtasks to the optimal number with applied constraints.

The specified number of subtasks for PARALLEL always overrides the specification of the PARAMDEG_UTIL subsystem parameter. Therefore, the value of PARALLEL can be smaller or larger than the value of PARAMDEG_UTIL.

End of change