Home | Previous Page | Next Page   Appendix E. Custom-Conversion Functions > The onpload Conversion Process >

API Functions

Depending on the value of the HPLAPIVERSION parameter in the plconfig file, onpload expects your custom-conversion function to have one of the prototypes listed below.

If the HPLAPIVERSION parameter is set to 0 or HPLAPIVERSION is not present in the plconfig file, use the following prototype:

/*
 * input::  char* outbuffer:  where to put your output.
 *          int   buflen:     size you have for your output.
 *          char* value:      the input value to work on.
 * return:: 0                 to indicate ok.
 *          non-zero          to discard entire record.
 */

int your_func(outbuffer, buflen, value)
    char *outbuffer;
    int   buflen;
    char *value;
{
    /* your processing here */
}

If the HPLAPIVERSION parameter is set to 1, use the following prototype:

/*
 * input::  char* outbuffer:  where to put your output.
 *          int   buflen:     size you have for your output.
 *          char* value:      the input value to work on.
 *          int   vallen:     size of the input value.
 * return:: 0                 to indicate ok.
 *          non-zero          to discard entire record.
 */

int your_func(outbuffer, buflen, value, vallen)
    char *outbuffer;
    int   buflen;
    char *value;
    int   vallen;
{
    /* your processing here */
}

To discard an entire record, return a nonzero value. Otherwise, return a zero value.

The following functions support your access to data in the source and destination buffers.

DBXget_source_value(fldname,buffer,buflen)

This routine retrieves the source value that is associated with fldname and copies the value to the specified buffer.

Arguments I/O Description
char *fldname Input Name of source field, as defined in ipload map
char *buffer Input Address where fldname value is placed
int buflen Input Buffer size in bytes

DBXget_dest_value(fldname,buffer,buflen)

This routine retrieves the destination value that is associated with fldname and copies the value to the specified buffer.

Arguments I/O Description
char *fldname Input Name of destination field, as defined in ipload map
char *buffer Input Address where fldname value is placed
int buflen Input Buffer size in bytes

DBXput_dest_value(fldname,buffer)

If a previous conversion has not set the destination value, this routine sets the destination value that is passed to the buffer. The ipload utility automatically clips the data value if it is too long.

Arguments I/O Description
char *fldname Input Name of destination field, as defined in ipload map
char *buffer Input Address where fldname value is placed

DBXget_dest_length(fldname)

This routine returns the maximum length of the data buffer that is associated with fldname.

Arguments I/O Description
char *fldname Input Name of destination field, as defined in ipload map
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]