Originally posted by: SystemAdmin
WTX documentation says "The Platform API provides tight integration of the WebSphere Transformation Extender into user applications that run in batch environments on a z/OS platform" . So its mainly for z Platforms.
I would suggest to start using the DTXPI (DTX Application Programming API) instead of Platform API. The Product does come with around 8 examples on how to use DTXPI. Platform API is a old way of invoking maps.
Below is a working example, I have
int main( int argc, char *argv[] )
{
EXITPARAM ExitParam;
int i, cnt = 1;
char *map = NULL, *default_map = "test.mmc";
if ( argc > 1 ) {
/* map name is optional 1st arg, allocate space for ite */
map = malloc( strlen(argv[1]) + 1 );
} else {
map = malloc( strlen(default_map) + 1 );
}
if ( argc > 2 ) {
/* no. of times to run map is optional 2nd arg */
cnt = atoi( argv[2] );
}
MercInitAPI();
/* run the map cnt times */
for ( i=0; i<cnt; i++ ) {
memset(&ExitParam,0,sizeof(EXITPARAM));
if ( argc > 1 ) {
strcpy( map, argv[1] );
} else {
strcpy( map, default_map );
}
ExitParam.lpDataToApp = (unsigned char *) map;
ExitParam.dwSize = sizeof(EXITPARAM);
RunMap(&ExitParam);
printf("Map returned: ExitParam.nReturn=%d; ExitParam.szErrMsg=%s\n", ExitParam.nReturn, ExitParam.szErrMsg );
if ( ExitParam.lpDataFromApp ) {
printf(" ExitParam.dwFromLen=%d, ExitParam.lpDataFromApp=", ExitParam.dwFromLen);
{ int i; for (i=0;i<ExitParam.dwFromLen;printf ("%c",ExitParam.lpDataFromApp
i++)); printf ("\n");}
} else {
printf(" ExitParam.dwFromLen=%d, ExitParam.lpDataFromApp=%s\n", ExitParam.dwFromLen, "NULL" );
}
if ( ExitParam.lpDataFromApp ) free( ExitParam.lpDataFromApp );
}
if ( map ) free( map );
/* it is OK to use MercExitAPI, but it does nothing. */
MercExitAPI();
return( 0 );
}
#DataExchange#IBM-Websphere-Transformation-Extender#IBMSterlingTransformationExtender