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):


$ node zzcall2.js
<?xml version='1.0'?><myscript><pgm name='QSYGETPH' lib='QSYS' error='fast'>
<error><![CDATA[*** error QSYS QSYGETPH ]]></error>
<version>XML Toolkit 1.9.2</version>
<error>
<errnoxml>1100016</errnoxml>
<xmlerrmsg><![CDATA[XML run pgm failed]]></xmlerrmsg>
<xmlhint><![CDATA[<pgm name='QSYGETPH' lib='QSYS' error='fast'><parm><data
ty]]></xmlhint>
</error>
<error>
<errnoxml>1000006</errnoxml>
<xmlerrmsg><![CDATA[PGMCALL failed]]></xmlerrmsg>
<xmlhint><![CDATA[QSYGETPH]]></xmlhint>
</error>
<error>
<errnoxml>1100016</errnoxml>
<xmlerrmsg><![CDATA[XML run pgm failed]]></xmlerrmsg>
<xmlhint><![CDATA[<pgm name='QSYGETPH' lib='QSYS' error='fast'><parm><data
ty]]></xmlhint>
</error>
<jobinfo>
<jobipc>undefined</jobipc>
<jobipcskey>FFFFFFFF</jobipcskey>
<jobname>QSQSRVR</jobname>
<jobuser>QUSER</jobuser>
<jobnbr>561532</jobnbr>
<jobsts>*ACTIVE</jobsts>
<curuser>BRIAN</curuser>
<ccsid>37</ccsid>
<dftccsid>37</dftccsid>
<paseccsid>0</paseccsid>
<langid>ENU</langid>
<cntryid>US</cntryid>
<sbsname>QSYSWRK</sbsname>
<sbslib>QSYS</sbslib>
<curlib></curlib>
<syslibl>QSYS QSYS2 QHLPSYS QUSRSYS</syslibl>
<usrlibl>TECHCOMMON VVIPEYE VGPL VIPPHONE QGPL QTEMP</usrlibl>
<jobcpffind>see log scan, not error list</jobcpffind>
</jobinfo>
</pgm>
</myscript>
[ { type: 'pgm', success: false, pgm: 'QSYGETPH', lib: 'QSYS' } ]
[TypeError: Cannot read property 'forEach' of undefined]
$


Thanks in advance


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.