iUserSpace

class iUserSpace(conn)

Note

Deprecated: Will be removed in the next major version.

Arguments:
iUserSpace.createUserSpace(name, lib, attr, size, auth, desc, cb)

Note

Deprecated: Will be removed in the next major version.

Create a new user space. IBM i API: QUSCRTUS

Arguments:
  • name (string) – The user space name. (10 characters max).
  • lib (string) – The library name.
  • attr (string) – The extended attribute of the user space (11 characters max).
  • size (number) – The initial size of the user space.
  • auth (string) – The authority to the user space.
  • desc (string) – The description of the user space (50 characters max).
  • cb (createUserSpaceCallback) –
iUserSpace.deleteUserSpace(name, lib, cb)

Note

Deprecated: Will be removed in the next major version.

Delete the user space. IBM i API: QUSDLTUS

Arguments:
  • name (string) – The user space name.
  • lib (string) – The library name.
  • cb (deleteUserSpaceCallback) – The callback function.
iUserSpace.getUserSpaceData(name, lib, length, cb)

Note

Deprecated: Will be removed in the next major version.

Retrieves the content of the user space. IBM i API: QUSRTVUS

Arguments:
  • name (string) – The user space name.
  • lib (string) – The library name.
  • length (string) – The length of the data to retrieve.
  • cb (getUserSpaceDataCallback) – The callback function.
iUserSpace.setUserSpaceData(name, lib, length, msg, cb)

Note

Deprecated: Will be removed in the next major version.

Set the content of the user space. IBM i API: QUSCHGUS

Arguments:
  • name (string) – The user space name.
  • lib (string) – The library name.
  • length (string) – Tthe length of the data to set.
  • msg (string) – The data to set.
  • cb (setUserSpaceDataCallback) – The callback function.
createUserSpaceCallback(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.
setUserSpaceDataCallback(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.
getUserSpaceDataCallback(error, output)
Arguments:
  • error (Error|null) – the error object if an error occured or null.
  • output (string|null) – This is the output from the user space if successful or null when an error occurs.
deleteUserSpaceCallback(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

Create a new user space

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

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

const userSpace = new iUserSpace(connection);

userSpace.createUserSpace('myuserspace', 'mylib', 'LOG', 50, 'EXCLUDE', 'Example User Space', (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});

Set the content of the user space

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

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

const userSpace = new iUserSpace(connection);

userSpace.setUserSpaceData('myuserspace', 'mylib', 20, 'Hello!', (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});

Retrieve the content of the user space

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

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

const userSpace = new iUserSpace(connection);

userSpace.getUserSpaceData('myuserspace', 'mylib', 20, (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});

Delete the user space

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

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

const userSpace = new iUserSpace(connection);

userSpace.deleteUserSpace('myuserspace', 'mylib', (error, output) => {
  if (error) {
    throw error;
  }
  console.log(output);
});