Dataloader/MP Reference Manual

Table Of Contents
Creating a Customized Version of DataLoader/MP
DataLoader/MP Reference Manual424148-003
5-4
User Exit Descriptions
User Exit Descriptions
The interfaces to user exits are designed so your code can be written in C or
COBOL85. Exits have uppercase names, they accept all parameters by reference, and
if they return a value indicating how they functioned, it is returned in a parameter
named Status.
The following descriptions describe the C prototypes. The SEXITSCB file, described on
page 2-1, contains COBOL models.
BUILDKEY
The BUILDKEY exit is given the input record and builds the key associated with the
record.
The syntax for this procedure follows:
BUILDKEY assumes that the record’s key is the first 255 bytes, or the length of the
record if it is shorter. If your record’s key differs from this, you should replace
BUILDKEY with your own version.
BUILDKEY is called for each record if an output file has the KEYRANGE interpretation,
or if the -P parameter is specified, asking DataLoader/MP to estimate the partition
boundary keys. BUILDKEY can determine the reason it was called by testing the
Purpose parameter. If the Purpose parameter is 0, it has been called for partition
boundary estimation purposes. If it is 1, it has been called because of a write to a file
with the KEYRANGE interpretation. These are the only two reasons BUILDKEY is
called.
The key built by BUILDKEY must be made up of printable characters. If the actual key
has nonprintable characters in it, such as in a binary number, BUILDKEY needs to
convert it to a printable form, such as hex or decimal. This restriction is imposed to
make the creation of keyrange files easier as well as to make the output readable
when doing partition boundary estimation.
If BUILDKEY returns a Status of 0, this record is skipped. If BUILDKEY returns a
Status greater than 0, the returned key is used for the specified purpose.
If BUILDKEY was called for the purpose of writing to a file with the KEYRANGE
interpretation and the returned Status is -1, the record is written to all keyranges. If
the returned Status is -2, the record is written once, and only once, to each of the
files mentioned in the keyrange file.
void BUILDKEY( short* Purpose,
char* Record,
long* RecordLen,
char* KeyBuf,
long* KeyBufLen,
long* KeyLen,
short* Status)