lib/itoolkit.js
// run() sends the commands in XML document via REST or DB2 way. And fetch the response.

run() sends the commands in XML document via REST or DB2 way. And fetch the response.
run () sends the commands in XML document via REST or DB2 way . And fetch the response .
run(callback, sync) {
    let xml = i_xml.iXmlNodeHead() + i_xml.iXmlNodeScriptOpen();
    for(let i = 0; i < this.cmds.length; i++)
      xml += this.cmds[i];
    xml += i_xml.iXmlNodeScriptClose();
    this.cmds = [];
    if (this.I_DEBUG_VERBOSE) {
      console.log("============\nINPUT XML\n============");
      console.log(xml);
      console.log("============\nOUTPUT XML\n============");
    }
    if (this.conn.I_TRANSPORT == I_TRANSPORT_REST) {
      const i_call = require('./irest');
      i_call.iRestHttp(callback,
        this.conn.I_TRANSPORT_REST_HOST,
        this.conn.I_TRANSPORT_REST_PORT,
        this.conn.I_TRANSPORT_REST_PATH,
        this.conn.I_TRANSPORT_DB2_DATABASE,
        this.conn.I_TRANSPORT_DB2_USER,
        this.conn.I_TRANSPORT_DB2_PASSWORD,
        this.conn.I_TRANSPORT_IPC,
        this.conn.I_TRANSPORT_CTL,
        xml,
        this.conn.I_TRANSPORT_REST_XML_OUT_SIZE);
    } else if (this.conn.I_TRANSPORT == I_TRANSPORT_DB2) {
        const db = require('./istoredp');
        db.db2Call(callback, 
        this.conn.I_XML_SERVICE_LIB,
        this.conn.I_TRANSPORT_DB2_DATABASE,
        this.conn.I_TRANSPORT_DB2_USER,
        this.conn.I_TRANSPORT_DB2_PASSWORD,
        this.conn.I_TRANSPORT_IPC,
        this.conn.I_TRANSPORT_CTL,
        xml,
        this.conn.I_TRANSPORT_REST_XML_OUT_SIZE,
        this.I_DEBUG_VERBOSE,
        sync);
    } else {
        callback(i_xml.iXmlNodeHead() + i_xml.iXmlNodeScriptOpen() + i_xml.iXmlNodeError("***Transport error no data***") + i_xml.iXmlNodeScriptClose());
    }
  }
run ( callback , sync ) { let xml = i_xml . iXmlNodeHead ( ) + i_xml . iXmlNodeScriptOpen ( ) ; for ( let i = 0 ; i < this . cmds . length ; i ++ ) xml += this . cmds [ i ] ; xml += i_xml . iXmlNodeScriptClose ( ) ; this . cmds = [ ] ; if ( this . I_DEBUG_VERBOSE ) { console . log ( "============\nINPUT XML\n============" ) ; console . log ( xml ) ; console . log ( "============\nOUTPUT XML\n============" ) ; } if ( this . conn . I_TRANSPORT == I_TRANSPORT_REST ) { const i_call = require ( './irest' ) ; i_call . iRestHttp ( callback , this . conn . I_TRANSPORT_REST_HOST , this . conn . I_TRANSPORT_REST_PORT , this . conn . I_TRANSPORT_REST_PATH , this . conn . I_TRANSPORT_DB2_DATABASE , this . conn . I_TRANSPORT_DB2_USER , this . conn . I_TRANSPORT_DB2_PASSWORD , this . conn . I_TRANSPORT_IPC , this . conn . I_TRANSPORT_CTL , xml , this . conn . I_TRANSPORT_REST_XML_OUT_SIZE ) ; } else if ( this . conn . I_TRANSPORT == I_TRANSPORT_DB2 ) { const db = require ( './istoredp' ) ; db . db2Call ( callback , this . conn . I_XML_SERVICE_LIB , this . conn . I_TRANSPORT_DB2_DATABASE , this . conn . I_TRANSPORT_DB2_USER , this . conn . I_TRANSPORT_DB2_PASSWORD , this . conn . I_TRANSPORT_IPC , this . conn . I_TRANSPORT_CTL , xml , this . conn . I_TRANSPORT_REST_XML_OUT_SIZE , this . I_DEBUG_VERBOSE , sync ) ; } else { callback ( i_xml . iXmlNodeHead ( ) + i_xml . iXmlNodeScriptOpen ( ) + i_xml . iXmlNodeError ( "***Transport error no data***" ) + i_xml . iXmlNodeScriptClose ( ) ) ; } }
run() sends the commands in XML document via REST or DB2 way.
run () sends the commands in XML document via REST or DB2 way .
// Build the XML document.
 // Print the XML document if in debug mode.
 // Post the XML document to XML service program.
