× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I installed Node on my Windows 7 laptop.

I went to the npm site (https://www.npmjs.com/package/itoolkit) and installed iToolkit using the command: node i itoolkit

I wrote a small script named helloIBMi.js shown here:
const xt = require('itoolkit');
var conn = new xt.iConn('mysystem', 'myname', 'mypwd');
conn.debug(true);
console.log('Current XML Service Library is : ');
console.log(conn.getConnection().I_XML_SERVICE_LIB);
console.log('end script');

This script worked. It made the connection and returned the service library name:
node helloIBMi
Current XML Service Library is :
QXMLSERV
end script

I then tried to add a command from example on the API page (https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/IBM%20i%20Technology%20Updates/page/Toolkit%20for%20i%20APIs?section=iSh). I tried to delete a file in the IFS using the iCmd class:
const xt = require('itoolkit');
var conn = new xt.iConn('mysystem', 'myname', 'mypwd');
conn.debug(true);
console.log('Current XML Service Library is : ');
console.log(conn.getConnection().I_XML_SERVICE_LIB);
conn.add(xt.iCmd("RMVLNK OBJLNK('/mydir/nodetest.txt')"));
function cb(str) {console.log(str);}
conn.run(cb);
console.log('end script');

This fails. The “conn.run(cb)” line is what throws the errors. The errors I get in the console are:
node helloIBMi
Current XML Service Library is :
QXMLSERV
============
INPUT XML
============
<?xml version='1.0'?><myscript><cmd exec='cmd' error='fast'>RMVLNK OBJLNK('/mydir/nodetest.txt')</cmd></myscript>
============
OUTPUT XML
============
{ Error: Cannot find module 'idb-connector'
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Object.db2Call (C:\mydirectorypath\node_modules\itoolkit\lib\istoredp.js:89:14)
at iConn.run (C:\mydirectorypath\node_modules\itoolkit\lib\itoolkit.js:278:10)
at Object.<anonymous> (C:\mydirectorypath\helloIBMi.js:11:6)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32) code: 'MODULE_NOT_FOUND' }
end script

I confirmed that all of the iToolkit *.js files are installed in the C:\mydirectorypath\node_modules\itoolkit\lib\ directory. The same *.js files are in my laptop directory as are in the IFS directory /QOpenSys/QIBM/ProdData/Node/os400/xstoolkit.

Any ideas? I can’t find a lot of documentation online to help me, and I’m also still pretty new.

Thanks,

Kelly Cookson
IT Project Leader
Dot Foods, Inc.
217-773-4486 ext. 12676
www.dotfoods.com<http://www.dotfoods.com>


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.