Hi,
We need to call QDCXLATE from itoolkit, to convert from hex ascii to ebcdic, but don't know how to. Until we can see the as400 doesn't have iconv; may be is too old.
Any help will be appreciated !!
Thanks
Hans
Help calling QDCXLATE from itoolkit
Re: Help calling QDCXLATE from itoolkit
I'm confused - is the data in hex format (2 bytes per character) or simply in ASCII and you need it in EBCDIC?
iconv has been available for a long time and google will find you many examples. Even if you have an AS400 - which I doubt as they are _really_ old - it should be available.
iconv has been available for a long time and google will find you many examples. Even if you have an AS400 - which I doubt as they are _really_ old - it should be available.
Re: Help calling QDCXLATE from itoolkit
It's a long story, we have a propietary program that calls QDCXLATE with an hexadecimal data (4 bits) ascii, the call to QDCXLATE has the bitmaps to decode some iso8583 frames with transparent mode. I'm not an as400 expert, and need to call this program from nodejs with itoolkit.
Re: Help calling QDCXLATE from itoolkit
Why not use the node toolkit? https://www.npmjs.com/package/itoolkit
That should let you call it as you do now.
If you can't get that to work, I suggest asking the authors of the package.
That should let you call it as you do now.
If you can't get that to work, I suggest asking the authors of the package.
Re: Help calling QDCXLATE from itoolkit
Hi,
Thanks to all collaboration, in the end the next code calls the library using itoolkit:
Thanks again,
Hans
Thanks to all collaboration, in the end the next code calls the library using itoolkit:
Code: Select all
import { Connection, ProgramCall } from 'itoolkit';
import { XMLParser } from 'fast-xml-parser';
const conn = new Connection({
transport: 'odbc',
transportOptions: { dsn: '*LOCAL' },
});
const program = new ProgramCall('QDCXLATE');
const input = process.argv[2];
program.addParam({ name: 'par1', type: '5P0', value: 8 });
program.addParam({ name: 'par2', type: '512A', value: input });
program.addParam({ name: 'par3', type: '10A', value: 'QASCII' });
program.addParam({ name: 'par4', type: '10A', value: 'QSYS' });
conn.add(program);
conn.debug(1);
conn.run((error: any, xmlOutput: any) => {
if (error) {
console.log('error');
return;
}
try {
const Parser = new XMLParser();
const result = Parser.parse(xmlOutput);
if (result.myscript.pgm.error) {
console.log(JSON.stringify(result.myscript.pgm.error));
return;
}
const res = result.myscript.pgm.parm[1].data;
console.log(res);
// resolve(segundoParm.data || segundoParm);
} catch (error) {
console.log(error);
}
});
Thanks again,
Hans