The ADACDC User Exit

ADACDC calls a user exit at various points in its processing, providing you with the opportunity to intercede in that processing.

Note:
The user exit may not update or add compressed spanned records. A flag in the CDCU DSECT will indicate if the input compressed record is spanned.

This document covers the following topics:


Installing the Exit

Start of instruction setTo install the user exit

  1. Compile the user exit you wish ADACDC to use as module name ADACDCUX.

  2. Make the module available to the ADACDC utility.

A sample user exit called ADACDCUX is provided on the source data set. The only function of the sample is to show you how to add, delete, and update records using the user exit interface.

Warning:
ADACDCUX is a sample user program and is not supported under any maintenance contract agreement.

User Exit Interface

The user exit is called with the following registers set:

R1 user parameter list
R13 standard 72-byte register save area
R14 return address
R15 entry point

The user parameter list contains two pointers:

  • the first to the ADACDC user exit parameter list mapped by the CDCU DSECT; and

  • the second to the record area for the user exit where the record being processed is passed as appropriate.

The action to be performed is indicated in the CDCUFUNC field whereas the action the user exit directs ADACDC to take on return is indicated using the CDCURESP field.

graphics/cdc2_standard0.png

ADACDC User Exit

The structure of the ADACDC user exit interface control block (CDCU DSECT) is as follows:

Bytes Description
0-3 constant 'CDCU'
4-7 available for use by user exit
8-11 length of record in second parameter
12
function identifier:  
X'00' initialization
X'04' before pass to SORT input
X'08' before write to extract file
X'0C' before write to primary output file
X'10' termination
13
response code from user exit:
X'00' normal processing
X'04' ignore this record
X'08' record has been updated
X'0C' insert new record
14-31 reserved for future use

User Exit Calls

The following subsections describe the calls made to the user exit and their purpose.

Initialization Call (CDCUFUNC=CDCUINIT)

During initialization, ADACDC calls the user exit so that it can set up any areas it requires for future processing. The CDCUUSER field is provided in the CDCU for anchoring a user control block, if appropriate.

The record area pointer points to data that has no relevance for this call.

Termination Call (CDCUFUNC=CDCUTERM)

During termination, ADACDC calls the user exit so that it can close any open files or clean up any areas still outstanding after ADACDC execution. For example, if an anchor pointer was set in CDCUUSER, this area could be freed and the CDCUUSER field set to nulls.

The record area pointer points to data that has no relevance for this call.

SORT Input Call (CDCUFUNC=CDCUINPT)

ADACDC calls the user exit before a record is passed to the SORT routine as input.

The record area pointer points to the compressed data record to be returned prefixed by the CDCE control block.

The exit may elect to

  • continue processing normally;

  • request that the record be ignored;

  • update the current record; or

  • add a record, in which case the record pointed to by the record area pointer is passed to the SORT routine. Thereafter, each time the exit is called, the same record is presented again until

    • normal processing continues; or

    • the record is ignored or updated, at which time processing continues with the next input record.

Extract Output Call (CDCUFUNC=CDCUWRTE)

ADACDC calls the user exit before a record is written to the extract file during phase 1 processing. This exit point is only called during phase 1 processing and has no relevance in other cases.

The record area pointer points to compressed the data record to be written prefixed by the CDCE control block.

The exit may elect to

  • continue processing normally;

  • request that the record be ignored;

  • update the current record; or

  • add a record, in which case the record pointed to by the record area pointer on return is written to the extract file. Thereafter, each time the exit is called, the same record is presented again until

    • normal processing continues; or

    • the record is ignored or updated, at which time processing continues with the next record to be written to the extract file.

Primary Output Call (CDCUFUNC=CDCUWRTO)

ADACDC calls the user exit before a record is written to the primary output file. This exit point is not called during phase 1 processing and has no relevance in this case.

The record area pointer points to the decompressed data record to be written prefixed by the CDCO control block.

The exit may elect to

  • continue processing normally;

  • request that the record be ignored;

  • update the current record; or

  • add a record, in which case the record pointed to by the record area pointer on return is written to the primary output file. Thereafter, each time the exit is called, the same record is presented again until

    • normal processing continues; or

    • the record is ignored or updated, at which time processing continues with the next record to be written to the output file.

Updating or Adding Records

Consider the following points when updating or adding records from the exit:

  • The CDCELEN/CDCERECL fields must correctly reflect the length of data following the CDCEDATA field for the input and write extract exit points.

  • The CDCOLEN/CDCORECL fields must correctly reflect the length of data following the CDCODATA field for the input and write extract exit points.

  • For the input exit point, records added should have a unique ISN if no ISN update is to be replaced.

  • For the input exit point where an ISN is to be replaced, the last occurrence of the ISN should be updated or the replacement record for the ISN should be added after all occurrences for the ISN have been seen.

  • When adding records at the extract or primary output exit points, be aware that if file and ISN combinations are duplicated, the duplicated information is written to the primary output file which may confuse processing routines for that file.