Fourth Watch Software is pleased to announce the release of version 0.11.0 of Nodem. This version adds some new features to support legacy M APIs. Along with the previous version's support for local symbol table management, Nodem can now directly call any style of M API, without requiring the use of API wrapper code written in M.
- It adds support for passing arguments by reference, and by local variable, to the function and procedure methods, via use of a specially formatted argument object.
Here is an example of how you might use this functionality, using call by-reference, while in the Node.js REPL:
> var nodem = require('nodem');
undefined
> var gtm = new nodem.Gtm();
undefined
> gtm.open();
{ ok: true, result: 1, gtm_pid: 6162 }
> gtm.set({local: 'U', data: '^'});
{ ok: true, local: 'U', data: '^', result: 0 }
> gtm.procedure({procedure: 'LISTALL^ORWPT', arguments: [{type: 'reference', value: 'LIST', 'A', 1]});
{ ok: true,
procedure: 'LISTALL^ORWPT',
arguments: [ { type: 'reference', value: 'LIST' }, 'A', 1 ],
result: 0 }
> gtm.localDirectory();
[ 'LIST', 'U' ]
> gtm.data({local: 'LIST'});
{ ok: true, local: 'LIST', defined: 10 }
> gtm.nextNode({local: 'LIST'});
{ ok: true,
local: 'LIST',
subscripts: [ 1 ],
data: '1^ZZ PATIENT,TEST ONE^^^^ZZ PATIENT,TEST ONE',
defined: 1 }
> gtm.nextNode({local: 'LIST', subscripts: [1]});
{ ok: true,
local: 'LIST',
subscripts: [ 2 ],
data: '3^ZZ PATIENT,TEST THREE^^^^ZZ PATIENT,TEST THREE',
defined: 1 }
> gtm.nextNode({local: 'LIST', subscripts: [2]});
{ ok: true,
local: 'LIST',
subscripts: [ 3 ],
data: '2^ZZ PATIENT,TEST TWO^^^^ZZ PATIENT,TEST TWO',
defined: 1 }
> gtm.nextNode({local: 'LIST', subscripts: [3]});
{ ok: true, local: 'LIST', defined: 0 }
> gtm.close();
1
This is equivalent to this in GT.M direct mode:
YDB>set U="^"
YDB>do LISTALL^ORWPT(.LIST,"A",1)
YDB>zwrite LIST
LIST(1)="1^ZZ PATIENT,TEST ONE^^^^ZZ PATIENT,TEST ONE"
LIST(2)="3^ZZ PATIENT,TEST THREE^^^^ZZ PATIENT,TEST THREE"
LIST(3)="2^ZZ PATIENT,TEST TWO^^^^ZZ PATIENT,TEST TWO"
Stay tuned for the next couple of releases, which will add full support for asynchronous APIs, as well as a faster implementation of the core database APIs, via the new YottaDB C API.
You can find it at my github page: https://github.com/dlwicksell/nodem, as well as on the npm registry: npm install nodem.
David Wicksell
Fourth Watch Software LC