nodejs-itoolkit icon indicating copy to clipboard operation
nodejs-itoolkit copied to clipboard

ProgramCall - Function that returns a packed variable

Open tomcphr opened this issue 10 months ago • 8 comments

I'm trying to call a function on a service program that returns a packed variable but I can't seem to get it working.

I get this error message:

image

Would someone be able to let me know what I'm doing wrong here? I believe it's something to do with my return method call as if I remove this the call goes through successfully.

const conn = new Connection({
    transport: 'odbc',
    transportOptions: {
        host: 'box-hostname',
        username: 'username',
        password: 'password',
    },
});
conn.debug(true);
let pgm = new ProgramCall('PROGRAMNAME', { lib: 'LIBRARY', func: 'FUNCTIONNAME', error: 'ON'});
pgm.addParam({type: '30a', value: 'TYPE', by: 'ref'});
pgm.addParam({type: '30a', value: 'REF', by: 'ref'});
pgm.addReturn({type: '20p0', value: 0});
conn.add(pgm);

conn.run((error: any, xmlOutput: any) => {
    if (error) {
        throw error;
    }
    console.log(xmlOutput);
});

Node: v20.12.2 XML Toolkit 2.0.2-dev

tomcphr avatar Apr 19 '24 13:04 tomcphr