Dataloader/MP Reference Manual
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to DataLoader/MP
- 2 DataLoader/MP Components
- 3 Running DataLoader/MP
- 4 Specifying File-Related Options for DataLoader/MP
- 5 Creating a Customized Version of DataLoader/MP
- User Exits
- User Exit Descriptions
- BUILDKEY
- CHECKARG
- CONVERTIT
- DELETEIT
- DONEWITHTRANSACTION
- EXITSDESCRIPTION
- GETNEXTRECORD
- INITIALIZE1
- INITIALIZE2
- INSERTIT
- INSTRUCTIONS
- MISC1, MISC2, MISC3, and MISC4
- NEWTRANSACTION
- NEXTINDIRECTFILE
- SKIPPING
- STATISTICSTIME
- TERMINATING
- T0330U00_DEFAULTEXITS_C
- T0330U00-DEFAULTEXITS-COBOL
- T7900D41_DEFAULTEXITS_C
- T7900V00-DEFAULTEXITS-COBOL
- UPDATEIT
- Default User Exits
- DataLoader/MP Library
- The MAKE Routine for NM DataLoader/MP
- The MAKE Routine for Nonnative Mode DataLoader/MP
- 6 DataLoader/MP Examples
- 7 Recovery Strategies
- A Error and Warning Messages
- B Processing Flowcharts
- C C-Only Error Functions
- Index

Creating a Customized Version of DataLoader/MP
DataLoader/MP Reference Manual—424148-003
5-18
Data Conversion
The syntax for this procedure follows:
Buf is a pointer to the record whose fields are to be converted. NumFields is the
number of fields to be converted. Offsets is a pointer to NumFields 32-bit values
that give the offsets (counting from zero) of the fields to be converted. FieldSizes is
a pointer to NumFields 32-bit values that give the sizes of the fields whose offsets are
in the corresponding position of Offsets.
Example
This example illustrates how to use the DTLSwitchEndian function in a CONVERTIT
user exit to reverse the bytes of binary integer fields when the data is being moved
from a system with one byte order to a system with the other byte order.
It is extra work to get the compiler to compute the offsets and lengths, but it is worth
the effort so you do not have to compute the offsets. Remember there will be filler
bytes dropped in when a field has to be at a multiple of 2, 4, or 8 bytes from the
beginning of the structure, so it is not accurate to count the bytes in your structure
declaration.
sizes, offsets arrays and NumFields are declared static and are set up in the
initial data of the program so they are not computed on every entry to CONVERTIT.
#include "dtloadh" nolist
#include <asserth> nolist
DTLEXP
void WINAPI CONVERTIT(
char* RecIn,
long* RecInLen,
char* RecOut,
long* RecOutLenMax,
long* RecOutLen,
short* Status
)
{
/* This is the record structure */
typedef struct
{
char c1[10];
long c2;
long c3;
char c4[20];
long long c5;
short c6[3];
} input_record;
input_record* i_r;
/*
This array holds the offset from the beginning of the
record of each field to be switched.
void DTLSwitchEndian (char* Buf, long* NumFields,
DTLLEN* Offsets, DTLLEN* FieldSizes);