Dataloader/MP Reference Manual

Table Of Contents
Creating a Customized Version of DataLoader/MP
DataLoader/MP Reference Manual424148-003
5-6
DELETEIT
DELETEIT
The DELETEIT exit is called when you explicitly request it by specifying the letter d or
D in the list of user exits called through the -X parameter. Its function is to attempt to
delete a row from the database.
The syntax for this procedure follows:
If the deletion is successful, DELETEIT should return a positive value. If the deletion is
not successful, it should return a negative value. If the record should not be processed
any more by DataLoader/MP, DELETEIT should return a zero (0) value.
To make it easier to collect statistics on row deletions, a utility procedure named
DTLDeletedResult is provided and should be called immediately after the execution of
the embedded SQL delete. This utility does a number of things:
Checking SQLCODE
Checking the SQLCA
Updating DataLoader/MP’s internal statistics
Returning a value appropriate for the Status returned from DELETEIT
For this reason, all DELETEIT user exits should follow this format:
DONEWITHTRANSACTION
The DONEWITHTRANSACTION exit is called only if the -T parameter is specified, just
before DataLoader/MP commits the current transaction.
The syntax for this procedure follows:
The purpose of this exit and its associated exit NEWTRANSACTION is to enable the
use of SQL cursors together with TMF protection. All work done with a cursor must be
done under the same transaction under which the cursor was opened. For example,
you cannot open a cursor at the beginning of a job, do a number of transactions, and
close the cursor at the end of the job. The cursor must be closed at the end of each
transaction and reopened (specifying the next set of data to be processed) at the
beginning of the next one. DONEWITHTRANSACTION and NEWTRANSACTION
provide opportunities to close any open cursors and open any new cursors.
void DELETEIT( char*Rec, long* RecLen, short* Status )
void DELETEIT( char*Rec, long* RecLen, short* Status )
{
...
EXEC SQL delete ..... ;
*Status = DTLDeletedResult( &sqlcode, &sqlca );
}
void DONEWITHTRANSACTION( void )