sponsored links

Collapse

Announcement

Collapse
No announcement yet.

getting started with Node.js - itoolkit

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • getting started with Node.js - itoolkit

    How do you handle errors on the connection object if invalid login credentials are passed in?
    Code:
    const xt = require('itoolkit');
    var userID = 'foo';
    var pwd = 'bar';
    
    var conn = new xt.iConn("*LOCAL", userID, pwd);
    conn.add(xt.iCmd("RTVUSRPRF INLPGM(?) INLPGMLIB(?) TEXT(?) INLMNU(?) INLMNULIB(?)"));
    conn.run(function (str) {
        console.log("In callback for RTVUSRPRF");
    
        var results = xt.xmlToJson(str);
    
        var initPgm = results[0].data[0].value;
        var initPgmLib = results[0].data[1].value;
        var desc = results[0].data[2].value;
        var initMnu = results[0].data[3].value;
        var initMnuLib = results[0].data[4].value;
        //var ccsid = results[0].data[5].value;
    });
    I've taken a look at the documentation, but didn't see how to trap an error.
    https://www.ibm.com/developerworks/c...ect%20itoolkit

sponsored links

Collapse

Working...
X