Process Commands (QCAPCMD) API


  Required Parameter Group:


  Default Public Authority: *USE

  Threadsafe: Yes. See Usage Notes for command considerations.

The Process Commands (QCAPCMD) API is used to perform command analyzer processing on command strings. You can check or run CL commands from HLLs as well as check syntax for specific source definition types.

You can use the QCAPCMD API to:


Authorities and Locks

Command
*USE
Command library
*EXECUTE

Required Parameter Group

Source command string
INPUT; CHAR(*)

The command string to be prompted for or run.

Length of source command string
INPUT; BINARY(4)

The length of the source command string. Valid values are between 1 and 32 702. Message CPF3C1D will result for values outside this range. This length can include trailing blanks.

Options control block
INPUT; CHAR(*)

The options that control the handling of the command string. The layout of this parameter is the CPOP0100 Format.

Options control block length
INPUT; BINARY(4)

The length of the options control block. A minimum length of 20 is required for the CPOP0100 format.

Options control block format
INPUT; CHAR(8)

The format of the options control block. CPOP0100 is the only valid value. For more information, see CPOP0100 Format.

Changed command string
OUTPUT; CHAR(*)

The rebuilt command string. This is the updated command string, which includes changes from prompting, ordering of parameters, and the addition of keywords. This string may be substantially longer than the source command string. If an error occurs that prevents the command string from being rebuilt, this field is not changed. No padding is performed on the value returned. The length of changed command string available to return parameter should be used to determine how much data is returned.

Length available for changed command string
INPUT; BINARY(4)

The length available to return the updated command string. If an updated command string is not desired, a special value of 0 may be specified. This value must be a positive number or zero.

Length of changed command string available to return
OUTPUT; BINARY(4)

The length of the changed command string returned or available to return. If zero is specified for the length available for changed command string parameter, this value is not set. If an error occurs that prevents the command string from being rebuilt, this field is zero. If the changed command string parameter is not large enough to hold the entire rebuilt command string, this value is the total length available. The changed command string is truncated.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter.


CPOP0100 Format

The CPOP0100 format includes information on the contents of the options control block parameter. The following table shows how this information is organized. For detailed descriptions of the fields in the list, see Field Descriptions.



Field Descriptions

CCSID of command string. CCSID of the command string. The possible values are:

Command string syntax. Whether command processing should be done in IBM® i mode or System/38™ mode. The possible values are:

DBCS data handling. Whether the command analyzer should handle the SO/SI characters as DBCS delimiters. It is valid with all classes of command processing. This option is the equivalent of specifying the IGC process control parameter on the Execute Command (QCMDEXC) and Check Command Syntax (QCMDCHK) APIs. The possible values are:

Message retrieve key. The message retrieve key identifies a request message. If prompting is requested, the request message identified by the message retrieve key is replaced by the updated command string. The updated command can then be logged in the job log. If the message key contains all hexadecimal zeros or all blanks, no request message is updated. The message key is valid for processing command types 0, 1, 2, and 3. The message key is ignored for processing command types 4, 5, 6, 7, 8, and 9. The message key is valid only during the current job.

Prompter action. Indicates whether the prompter should be called on a command string.

Reserved. This area must be set to hexadecimal zeros.

Type of command processing. The type of command processing to be performed by the system. The following processes can occur:


Usage Notes

  1. While this API is threadsafe, it should not be used to run a command that is not threadsafe in a job that has multiple threads. Use the Display Command (DSPCMD) command to determine whether a command is threadsafe.

  2. The prompt actions controlled by the prompter option field in the option control block have the following considerations.

    • For commands with a value of 0, 1, 2, or 3 for the type of command processing field, a prompt occurs when 2 is specified for the prompter option field if:

      • Selective prompting is specified in the source command string parameter.

      • The job is running interactively.

    • If this API is called in a batch job with a valid prompt request, it is ignored. A valid prompt request is issued by specifying:

      • 1 for the prompter option field

      • 2 for the prompter option field with selective prompting characters in the command string

      • 3 for help

  3. Calls of the API in batch jobs with values of 4, 5, 6, or 7 for the type of command processing field are processed. However, prompting requests are ignored.

  4. The prompter option field in the options control block is ignored if 10 is specified for the type of command processing field.

  5. If the command to be executed is a proxy command, the QCAPCMD API will resolve to the target command. If the target command is also a proxy, the process repeats until either a non-proxy command is found, or the proxy chain becomes greater than the allowed maximum. Once a non-proxy command is found, the resolved command will replace the proxy command in the command string to be executed.

  6. Proxy commands will be resolved before the command exit points QIBM_QCA_CHG_COMMAND and QIBM_QCA_RTV_COMMAND are called.


Error Messages



API introduced: V2R3

[ Back to top | Program and CL Command APIs | APIs by category ]