Search in sources :

Example 1 with ECIRequest

use of com.ibm.ctg.client.ECIRequest in project convertigo by convertigo.

the class CicsTransaction method runCore.

public void runCore() throws EngineException {
    ECIRequest eciRequestObject = null;
    String strServer = null;
    String strUserID = null, strUserPassword = null;
    String strProgram = null, strTransactionID = null;
    String errmsg = null;
    byte[] abytCommarea = null;
    int iCommareaSize = 0;
    try {
        connector = ((CicsConnector) parent);
        strServer = connector.getServer();
        strProgram = getProgram();
        strTransactionID = getTransactionId();
        strUserID = getUserId();
        strUserID = (strUserID.equals("") ? connector.getUserId() : strUserID);
        strUserPassword = getUserPassword();
        strUserPassword = (strUserPassword.equals("") ? connector.getUserPassword() : strUserPassword);
        if (Engine.logBeans.isTraceEnabled())
            Engine.logBeans.trace("(CicsTransaction) \n" + XMLUtils.prettyPrintDOM(context.inputDocument));
        // Initialize CommArea
        abytCommarea = getInputCommarea(cicsInput);
        iCommareaSize = abytCommarea.length;
        dump(abytCommarea, 0);
        // Use the extended constructor to set the parameters on the ECIRequest object
        eciRequestObject = new // ECI call type
        ECIRequest(// ECI call type
        ECIRequest.ECI_SYNC, // CICS server
        strServer, // CICS userid
        strUserID, // CICS password
        strUserPassword, // CICS program to be run
        strProgram, // CICS transid to be run
        strTransactionID, // Byte array containing the COMMAREA
        abytCommarea, // COMMAREA length
        iCommareaSize, // ECI extend mode
        ECIRequest.ECI_NO_EXTEND, // ECI LUW token
        0);
        Engine.logBeans.debug("(CicsTransaction) Request on server: " + strServer + " - program: " + strProgram + " - transId: " + strTransactionID);
        Engine.logBeans.debug("(CicsTransaction) Executing '" + getName() + "' transaction.");
        // Call the flowRequest method: if the method returns not null a security error has occurred.
        String t = context.statistics.start(EngineStatistics.APPLY_USER_REQUEST);
        try {
            errmsg = connector.flowRequest(eciRequestObject);
        } finally {
            context.statistics.stop(t);
        }
        if (errmsg != null) {
            Engine.logBeans.debug("(CicsTransaction) " + errmsg);
            throw new EngineException(errmsg);
        }
        // Treat Commarea returned data.
        dump(abytCommarea, 1);
        if (!connector.existGateway())
            connector.setData(abytCommarea);
        Element cics = parseOutputCommarea(abytCommarea);
        if (cics != null) {
            Element outputDocumentRootElement = context.outputDocument.getDocumentElement();
            outputDocumentRootElement.appendChild(cics);
            score += 1;
        }
    } catch (Exception e) {
        throw new EngineException("Exception in CicsTransaction.runCore()", e);
    }
}
Also used : ECIRequest(com.ibm.ctg.client.ECIRequest) CicsConnector(com.twinsoft.convertigo.beans.connectors.CicsConnector) Element(org.w3c.dom.Element) EngineException(com.twinsoft.convertigo.engine.EngineException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) EngineException(com.twinsoft.convertigo.engine.EngineException)

Aggregations

ECIRequest (com.ibm.ctg.client.ECIRequest)1 CicsConnector (com.twinsoft.convertigo.beans.connectors.CicsConnector)1 EngineException (com.twinsoft.convertigo.engine.EngineException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 Element (org.w3c.dom.Element)1