Modifying segment contents by using expressions
During a DEDB online restructure, the OUTPUT subcommand and its associated keywords (SEGMENT, WHERE, and FIELDS) can be used to modify the content of the segment. By default, the output areas will contain the full, unmodified contents of the input segments. You specify the OUTPUT subcommand with the PREPARE command. The Prepare function creates a Restructure Plan data set that contains information about the changes you want to make to the database. The Restructure Plan data set provides input for the Restructure function.
The following considerations apply when you use the OUTPUT subcommand:
You must specify one or more OUTPUT subcommands for the segment you want to modify.
When the OUTPUT subcommand is specified, all input and output areas are selected for restructure processing. The OUTPUT subcommand forces an early termination to occur during restructure post-processing. The early termination allows you to perform any necessary application program changes before bringing the database back online. EARLY_TERMINATION=(BEFORE,START_DATABASE) is assumed.
For more information about the operations and syntax rules for coding expressions, see .
The SEGMENT keyword is required on the OUTPUT subcommand.
Use this keyword to select segments of the specified name for modification during the restructure process.
To modify the segment contents, you can use the OUTPUT subcommand with the optional FIELDS keyword.
The FIELDS keyword specifies a list of expressions; the value of each expression is evaluated and placed into the output segment in the order that the expressions are specified. The length of the segment is computed by the product as the sum of the lengths of the values produced from these expressions.
The following figure shows an example in which the Prepare function specifies that a literal value be inserted into each occurrence of the output segment during a DEDB online restructure.
PREPARE DBD=dbdName..., OUTPUT SEGMENT=SEGD, FIELDS=(3:20,4P'0',23:*)
If you modify the position or length of the symbolic key field, the FIELDS keyword is required on each of the OUTPUT subcommands for that segment.
When you use the FIELDS keyword with the OUTPUT subcommand to modify the value of the symbolic key field, the segments must remain in ascending key sequence under their parent. Fast Path Online Restructure/EP does not provide a facility to resequence the dependent segments. The restructure process terminates if the dependent segments are not maintained in ascending key sequence.
The content of the output segment can be controlled by using conditional qualification that is specified by the optional WHERE keyword on the OUTPUT subcommand.
If multiple OUTPUT subcommands are specified for the same segment, the first subcommand in which the selection criteria is satisfied is used. If the selection criteria is not satisfied for any OUTPUT subcommand for a segment, the input segment is copied to the output area without modification.
The following figure shows an example in which the Prepare function specifies that the content of a segment be conditionally modified during a DEDB online restructure. If the WHERE condition specified on the OUTPUT subcommand is met, the FIELDS keyword modifies the segment content. If the condition is not met, the segment content remains unchanged.
Conditionally modifying segment contents by using WHERE keyword
PREPARE DBD=dbdName, OUTPUT SEGMENT=SEGD, FIELDS=(3:20,C'ABC',26:*), WHERE=(23:3 EQ C' ')