SQL/MX 2.x Database and Application Migration Guide (G06.23+, H06.04+, J06.03+)

Converting an SQL/MP Database to SQL/MX Tables
HP NonStop SQL/MX Database and Application Migration Guide540435-005
11-25
Using DataLoader/MX to Copy Data
long* RecOutLen,
short* Status
)
{
int *i;
double *f;
i = (int *) RecIn;
f = (double *) (RecIn + 4);
sprintf(RecOut, "%5d%10f%5s", *i, *f,(char *) (RecIn
+ 12));
*RecOutLen = 20; /* size of output buffer*/
*Status = 2; /*output is in new buffer*/
}
b. To create a customized DataLoader executable from the preceding source file,
issue this command:
$ build.sh myexits.c mydl
This command creates a customized DataLoader executable, mydl, in the
current directory.
2. Run the customized DataLoader executable:
$ run -name=/G/adl mydl -i=\$RECEIVE -o=\$RECEIVE -X=C
This command creates a DataLoader/MX process named $ADL, which reads input
from its own $RECEIVE and writes output to its own $RECEIVE. The presence of
the
–X=C option causes the customized CONVERTIT exit routine to be invoked.
This process waits for input to be sent to it.
3. From another session, run SQLCI (either from TACL or through gtacl), and copy
the data from the SQL/MP table into the DataLoader process.
> sqlci copy $data01.test.tab1, $adl; exit;
4. From a third session, run import to copy the data from the DataLoader process
into the SQL/MX table.
$ import cat.sch.tab1 -ip \$ADL -U tab1.fmt -W FIXED
Here, tab1.fmt is the format file that import uses to recognize the format of the
data sent from the DataLoader process. In this example, the contents of the format
file are:
[COLUMN FORMAT]
col=c1,N
col=c2,N
col=c3,N
[FIXED WIDTH FORMAT]
RecordLength=20
col=c1,1,5