Topic
1 reply Latest Post - ‏2014-07-21T11:21:31Z by GKearney
Bhoju
Bhoju
37 Posts
ACCEPTED ANSWER

Pinned topic Execute map using Java Program

‏2014-07-19T08:42:52Z |

Dear happy programmers,

I am in a process to transform our batch process to run the WTX maps using a java process rather running them with command servers, we are doing a POC now to see if we gain some performance improvement by doing this. .

Now to get started, i written a simple java program which can run the map, program shown below. However my requirements are input and output cards overriding, most of the input card of our maps are fetching data from database and the output cards are mostly creating files or calling a shell scripts on unix environment. 

I am seeking some help how to override the cards using a java program and leverage all the features which command server provides in a java process (Audit logging, work files, card overrideing, adapter overriding etc)  . Any help and quick answers would be highly appreciated as the POC indeed have some deadlines and i want to approach fast towards the concept proof so that we can allocate some budjet and have the developers further explore this opportunity.

** Code with which i got a jump start **

import com.ibm.websphere.dtx.dtxpi.MMap;
import com.ibm.websphere.dtx.dtxpi.MConstants;
import com.ibm.websphere.dtx.dtxpi.MException;

public class RunMap {

public static void main(String args[]) {

// Initialize the API
try {
        MMap.initializeAPI(null);

        // Create a map
        MMap map = new MMap("Test.aix");

        // Run the map
        map.run();

        // Check the return status
        int iRC = map.getIntegerProperty(MConstants.MPIP_OBJECT_ERROR_CODE, 0);
        String szMsg = map.getTextProperty(MConstants.MPIP_OBJECT_ERROR_MSG, 0);
        System.out.println("Map status: " + szMsg + " (" + iRC + ")");

        // Clean up
        map.unload();
        MMap.terminateAPI();
}
catch (MException e) {
        e.printStackTrace();
}
}
}

Thanks

Updated on 2014-07-30T11:51:57Z at 2014-07-30T11:51:57Z by paul.brett
  • GKearney
    GKearney
    46 Posts
    ACCEPTED ANSWER

    Re: Execute map using Java Program

    ‏2014-07-21T11:21:31Z  in response to Bhoju

    hi,

    Have you tried to look at the java examples provided with the WTX Examples in the following location ?.

    C:\IBM\WebSphere Transformation Extender 8.4.1\examples\dk\dtxpi\java

    For example Example5.java - Using Streams to Override Inputs and Outputs

    I hope that this information is of help to you.