A bit of background:
I am trying to access a keyed data queue from a node.js function using the IBM toolkit provided. Not entirely unexpectedly, the documentation with the toolkit is pretty sparse on examples
https://www.ibm.com/developerworks/ibmi/library/i-native-js-app-ibmi-with-nodejs/
They provide a script called "idataq.js" that shows examples of sending and receiving data to a non-keyed data queue. It appears to use XMLSERVICE under the covers to do so, and it works as far as my testing goes. However, that is no good if you want to access a keyed data queue.
I figured I would just create a modified version of the supplied "receiveFromDataQueue" function to include the extra parameters needed for a keyed data queue, but it fails miserably. The XML error response from XMLSERVICE is virtually useless, but I have managed to glean the fact that it expects only 5 parameters, not the 8 I want to send it. Does anyone know how to make the error responses more meaningful?
The code appears to just create an XML interface to the QRCVDTAQ program, so why would it complain about only wanting 5 parameters unless it is some sort of hardcoded limit for the API built in to XMLSERVICE somewhere? Does anyone know if this is the case. The basic code for the version that works looks like this:
var xt = require('./itoolkit');
var pgm = new xt.iPgm("QRCVDTAQ", {"lib":"QSYS"});
pgm.addParam(name, "10A");
pgm.addParam(lib == ""?"*CURLIB":lib, "10A");
pgm.addParam(length, "5p0");
pgm.addParam("", length + 1 + "A");
pgm.addParam(0, "5p0");this.conn.add(pgm.toXML());
this.conn.run(toJson);
but calling QSNDDTAQ like this does not work
var xt = require('./itoolkit');
var pgm = new xt.iPgm("QRCVDTAQ", {"lib":"QSYS"});
pgm.addParam(name, "10A");
pgm.addParam(lib == ""?"*CURLIB":lib, "10A");
pgm.addParam(length, "5p0");
pgm.addParam("", length + 1 + "A");
pgm.addParam(5, "5p0");this.conn.add(pgm.toXML());
pgm.addParam(keyOp, "2A");
pgm.addParam(keyLen, "3p0");
pgm.addParam(key, key.length + "A")
this.conn.run(toJson);
I thought I would try to write my own program to see if that would work (rather than using QRCVDTAQ directly) but I cannot find any examples of what my program signature should look like. I have looked at the documentation for XMLTOOLKIT for examples but (IMHO) the documentation is pretty dreadful.....not an uncommon complaint for IBM stuff.
Just a simple RPG example program would be useful.
Thanks
________________________________
NOTICE: The information in this electronic mail transmission is intended by CoralTree Systems Ltd for the use of the named individuals or entity to which it is directed and may contain information that is privileged or otherwise confidential. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email or by telephone, so that the sender's address records can be corrected.
--------------------------------------------------------------------------------
CoralTree Systems Limited
Company Registration Number 5021022.
Registered Office:
12-14 Carlton Place
Southampton
Hampshire
SO15 2EA
VAT Registration Number 834 1020 74.
As an Amazon Associate we earn from qualifying purchases.