iDataQueue

class iDataQueue(conn)

Note

Deprecated: Will be removed in the next major version.

Arguments
iDataQueue.clearDataQueue(name, lib, cb)

Note

Deprecated: Will be removed in the next major version.

Clears the data queue. IBM i API: QCLRDTAQ

Arguments
  • name (string) – the data queue name.

  • lib (string) – The library containing the data queue.

  • cb (clearDataQueueCallback) – The callback function.

iDataQueue.receiveFromDataQueue(name, lib, length, cb)

Note

Deprecated: Will be removed in the next major version.

Receives data from the data queue. IBM i API: QRCVDTAQ

Arguments
  • name (string) – The data queue name.

  • lib (string) – The library containing the data queue.

  • length (string) – The length of the data to retrieve.

  • cb (receiveFromDataQueueCallback) – The callback function.

iDataQueue.sendToDataQueue(name, lib, data, cb)

Note

Deprecated: Will be removed in the next major version.

Sends data to the data queue. IBM i API: QSNDDTAQ

Arguments
  • name (string) – The data queue name.

  • lib (string) – The library containing the data queue.

  • data (string) – The data to send to the data queue.

  • cb (sendToDataQueueCallback) – The callback function.

sendToDataQueueCallback(error, output)
Arguments
  • error (Error|null) – the error object if an error occured or null.

  • output (boolean|null) – This is true if successful or null when an error occurs.

receiveFromDataQueueCallback(error, output)
Arguments
  • error (Error|null) – the error object if an error occured or null.

  • output (string|null) – This is the output from the data queue if successful or null when an error occurs.

clearDataQueueCallback(error, output)
Arguments
  • error (Error|null) – the error object if an error occured or null.

  • output (boolean|null) – This is true if successful or null when an error occurs.

Examples

Send data to the data queue

const { Connection, iDataQueue } = require('itoolkit');

const connection = new Connection({
  transport: 'ssh',
  transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
});

const dq = new iDataQueue(connection);

dq.sendToDataQueue('TESTQ', 'TEST', 'Hello World!', (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});

Retrieve data from the data queue

const { Connection, iDataQueue } = require('itoolkit');

const connection = new Connection({
  transport: 'ssh',
  transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
});

const dq = new iDataQueue(connection);

dq.receiveFromDataQueue('mydq', 'mylib', 20, (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});

Clear the data queue

const { Connection, iDataQueue } = require('itoolkit');

const connection = new Connection({
  transport: 'ssh',
  transportOptions: { host: 'myhost', username: 'myuser', password: 'mypassword' },
});

const dq = new iDataQueue(connection);

dq.clearDataQueue('mydq', 'mylib', (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});