Nonstop Database, HiRDB Version 9 Command Reference

[Contents][Index][Back][Next]

8.11.3 Overview of UOC processing

Figure 8-26 Overview of UOC processing provides an overview of UOC processing and Figure 8-27 Call sequence between pdrorg and UOC shows the call sequence between pdrorg and UOC.

Figure 8-26 Overview of UOC processing

[Figure]

Explanation:

Control is passed from pdrorg to the UOC and processing is started. When the processing is finished, control is returned to pdrorg.

  1. Checks the call type set by pdrorg in the UOC interface area.
  2. Performs start processing, such as initialization and UOC data file open processing.
  3. Updates or edits the data set by pdrorg in the UOC interface area.
  4. When there is no more data, the UOC performs termination processing, such as closing the UOC data files.
  5. If pdrorg processing or internal UOC processing results in an error, the UOC performs termination processing, such as closing the UOC data files and deleting unneeded UOC data files.
  6. Checks the row data to determine whether or not it is needed. If the row data is needed, the UOC updates or edits the data and sets the storage flag in the UOC interface area to Y. If the row data is not needed, the UOC sets the storage flag in the UOC interface area to N. If the UOC is to create a UOC data file, it saves the updated or edited row data in the UOC data file.
  7. Sets the return code in the UOC interface area.

    Figure 8-27 Call sequence between pdrorg and UOC

    [Figure]

Explanation:

In the case of reorganization or an unload operation in units of schemas, steps 1 to 11 are repeated for each table in the schema. If an error occurs during table processing, pdrorg processing is cancelled immediately.

  1. pdrorg sets the start request as the call type and calls the UOC.
  2. If the type of call from pdrorg is a start request, the UOC executes the following processing:
    • If the UOC is to output a UOC data file, it creates (opens) the UOC data file.
    • The UOC performs preparations for starting processing, such as allocation of various areas.
    • If the preparations are completed successfully, the UOC sets return code 0 in the UOC interface area; if not, the UOC sets return code 8 and returns control.
    If return code 8 is set, you must perform post-processing, such as closing the UOC data file because the UOC can no longer be called (no stop request is issued).
  3. pdrorg checks the UOC's return code set in the UOC interface area. If it is neither 0 nor 4, pdrorg cancels its processing immediately.
  4. pdrorg retrieves data in the database.
  5. If pdrorg was able to retrieve table data, it set the retrieved data in the data address list, sets a data update request as the call type, and calls the UOC. When there is no more data to be retrieved, pdrorg performs step 10 (termination processing).
    The data update request is processed repeatedly until any of the following conditions is satisfied:
    • There is no more table data.
    • The UOC sets a return code other than 0 or 4 in the UOC interface area.
    • An internal processing error occurs in pdrorg.
  6. If the type of call from pdrorg is a data update request, the UOC executes the following processing:
    If each process terminates normally, UOC sets return code 0 in the UOC interface area; if a process terminates abnormally, the UOC sets return code 8 and returns control.
    (a) When deleting unneeded data for table reorganization or the unload operation
    The UOC references the data that was passed from pdrorg to the data address list in the UOC interface area. If the data is needed, the UOC sets the storage flag to Y in the UOC interface area. If the data is not needed, the UOC sets the storage flag to N.
    (b) When updating data for use by applications
    The UOC executes processing such as data updating.
    If the UOC has updated data, it sets the post-update data address list in the UOC interface area and sets the storage flags to Y.
    If the data is unneeded, the UOC sets the storage flag to N in the UOC interface area.
    If the UOC is to output a UOC data file, it saves the needed data in the UOC data file.
  7. If the UOC has set return code 8 in the UOC interface area, pdrorg sets a stop request as the type of call and calls the UOC.
  8. If the type of call from pdrorg is a stop request, the UOC executes termination processing. After this call, pdrorg cannot call the UOC again.
    • If you have created a UOC data file, close it. If you no longer need the created UOC data file, delete it at this stage.
    • Perform post-processing, such as freeing the allocated memory.
  9. If pdrorg is to output an unload data file and the storage flag in the UOC interface area is set to Y, pdrorg outputs data to the unload data file. If the storage flag is set to N, pdrorg does not output the data. If the data is to be updated (-W option is specified), pdrorg references the post-update data address list in the UOC interface area and outputs the data updated by the UOC to the unload data file in the format specified in the -W option.
  10. If all the following conditions are satisfied, pdrorg sets a termination request as the type of call and calls the UOC:
    • All data has been retrieved from the specified table.
    • An internal error occurred in pdrorg.
    • The return codes set by the UOC in the UOC interface area are all normal (0 or 4).
  11. If the type of call from pdrorg is a termination request, the UOC executes termination processing.
    • If you have created a UOC data file, close it.
    • Perform post-processing, such as freeing the allocated memory.