pjs.runCommand()



This command is used to execute an IBM i CL command. 

Parameters

  1. Command - A string containing a CL command to execute.

Exception Handling

An Error instance will be thrown with the following properties:

  • message - The IBM i message text.

  • error - The message id.

  • help - The message help text.

RPG Equivalent 

QCMDEXC System API

Examples

Check for existence of an object
var command = "CHKOBJ OBJ(QTEMP/WORKFILE) OBJTYPE(*FILE)"; var exists = true; try { pjs.runCommand(command); } catch(e) { exists = false; }



Create a duplicate file in QTEMP
var command = "CRTDUPOBJ OBJ(ORDERSP) FROMLIB(DATALIB) OBJTYPE(*FILE) TOLIB(QTEMP) NEWOBJ(WORKFILE) DATA(*NO)"; pjs.runCommand(command);



Requirements

This API requires the Profound.js Connector module.