Greetings! Passed this over to the development team. Here is the
response...

The password parameter needs to be appended by blank characters to make
its length to be 10. For example, if the password id TEST, then set
parameter 2 as

* pgm.addParam("TEST ", "10A")

And there are some debugging tips for using xstoolkit. One is to enalble
the full error log using

* var pgm = new xt.iPgm("QSYGETPH",{"lib":"QSYS", "error":"on"})

The other is to enable the verbose mode by using conn.debug(true)

Tim


Tim Rowe, timmr@xxxxxxxxxx
Business Architect Application Development & Systems Management for IBM i
IBM i Development Lab, Rochester, MN
(507) 253-6191 (Tie) 553-6191

http://www-03.ibm.com/systems/power/software/i/are/index.html



----- Original message -----
From: Brian Garland <brian.garland@xxxxxxxxxx>
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxx>
To: web400@xxxxxxxxxxxx
Cc:
Subject: [WEB400] node.js calling program - possible parameter issue
Date: Thu, Mar 17, 2016 10:00 AM

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

--
Brian J. Garland
Vermont Information Processing, Inc.
brian.garland@xxxxxxxxxx

--
This email and any files transmitted with it are confidential and
intended
solely for the use of the individual or company to whom they are
addressed.
Do not disclose, distribute, or copy this email to others outside your
company. If you have received this email in error, please notify the
sender
immediately and delete this email from your system.
--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [1]http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [2]http://archive.midrange.com/web400.


References

Visible links
1. http://lists.midrange.com/mailman/listinfo/web400
2. http://archive.midrange.com/web400

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.