I copied the zzcall.js example to try to call the QSYGETPH api and I'm
getting an error in the result. zzcall.js works fine and I also created a
copy to call an RPGLE program I wrote that is a wrapper over QSYGETPH and
it works fine. I think it has to be parameter definitions, but I do not
know what could be wrong.
Here's the code I am using to call the API:
var xt =
require('/QOpenSys/QIBM/ProdData/Node/os400/xstoolkit/lib/itoolkit')
var conn = new xt.iConn("*LOCAL")
var pgm = new xt.iPgm("QSYGETPH",{"lib":"QSYS"})
pgm.addParam("BRIAN", "10A")
pgm.addParam("TEST", "10A")
pgm.addParam(" ", "12A")
pgm.addParam([
[0,"10i0"],
[0,"10i0"],
[" ", "7A"],
[" ", "1A"],
[" ", "256A"]
])
pgm.addParam(10, "10i0")
pgm.addParam(-1, "10i0")
conn.add(pgm.toXML())
function my_call_back(str) {
var results = xt.xmlToJson(str)
console.log(str)
console.log(results)
results.forEach(function(result, index){
result.data.forEach(function(data, index2){
console.log("type:" + data.type + " value:" + data.value)
})
})
}
conn.run(my_call_back)
And, here is what I get when I run it (note the added console.log
statements to dump the XML and json):
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.