IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Using C platform API

    Posted 11/22/12 05:45 AM

    Originally posted by: SystemAdmin


    I am trying to run the sample API code in C language that is given in IBM WTX v8.4 documentation. Please find attached the sample code. I have compiled the code in VS2005 with runmerc32.lib and runmerc.h files. When the .exe file so created is run on a Machine with IBM WTX v8.4 and compiled maps I get the following error...
    I get a windows pop up window saying "testapp.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
    #IBMSterlingTransformationExtender
    #DataExchange
    #IBM-Websphere-Transformation-Extender


  • 2.  Re: Using C platform API

    Posted 11/22/12 05:47 AM
      |   view attached

    Originally posted by: SystemAdmin


    Please suggest the ways to fix this issue. Please find attached the sample code I am trying to run.
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender

    Attachment(s)



  • 3.  Re: Using C platform API

    Posted 11/25/12 06:25 AM

    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.lpDataFromAppi++)); 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


  • 4.  Re: Using C platform API

    Posted 05/05/15 08:06 AM

    Originally posted by: Surabhi_k


    this example given above is using platform APIs, could you please post the working code using DTXPI (DTX Application Programming API)?


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange


  • 5.  Re: Using C platform API

    Posted 05/06/15 03:39 AM
      |   view attached

    Originally posted by: paul.brett


    Examples can be found at :

    [WTX installation directory]\examples\dk\dtxpi\c and [WTX installation directory]\examples\dk\dtxpi\csharp.

    One such example (c) is attached.

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender
    #DataExchange

    Attachment(s)

    c
    example1.c   1 KB 1 version


  • 6.  Re: Using C platform API

    Posted 05/06/15 03:50 AM
      |   view attached

    Originally posted by: paul.brett


    I ran the 'example1.c' example using Microsoft Visual C++ 2008 Express Edition.  I started a Microsoft Visual Studio 2008 Command Prompt.  The complete output of my execution is attached.

    In summary:

    C:\IBM\WebSphereTX8.4\examples\dk\dtxpi>example1.exe
    Map status: Map completed successfully (0)

    Thank-you.

    Paul.

    Follow me on Twitter


    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender
    #DataExchange

    Attachment(s)

    txt
    CommandLineOutput.txt   4 KB 1 version