CL or HLL command processing program

This topic describes the command processing program for CL or HLL.

The figure below shows the relationship between the Create Command (CRTCMD) command, the command definition statements, and the command processing program for CL and high level languages (HLL).

Figure 1. Command Relationships for CL and HLL
Command Relationships for CL and HLL

If the command processing program is a program written in CL, the variables that receive the parameter values must be declared to correspond to the type and length specified for each PARM statement. The following shows this correspondence.

PARM Statement Type PARM Statement Length Declared Variable Type Declared Variable Length
*DEC x y1 *DEC x y1
*LGL 1 *LGL 1
*CHAR n *CHAR ≤n2
*NAME n *CHAR ≤n2
*CNAME n *CHAR ≤n2
*SNAME n *CHAR ≤n2
*GENERIC n *CHAR ≤n2
*CMDSTR n *CHAR ≤n2
*DATE 7 *CHAR 7
*TIME 6 *CHAR 6
*INT2 n *INT or *CHAR 2
*INT4 n *INT or *CHAR 4
*UINT2 n *UINT or *CHAR 2
*UINT4 n *UINT or *CHAR 4
:
1
x equals the length and y is the number of decimal positions.
2
For character variables, if the length of the value passed is greater than the length declared, the value is truncated to the length declared. If RTNVAL(*YES) is specified, the length declared must equal the length defined on the PARM statement.

A program written in CL used as a command processing program can process binary values (such as *INT2 or *INT4). The program can receive these values as character fields. In that case, the binary built-in function (%BINARY) can be used to convert them to decimal values. Otherwise, the CL program can declare them as integer variables.

The difference between *INT2 or *INT4 and *UINT2 or *UINT4 is that the *INT2 and *INT4 types are signed integers and the *UINT2 and *UINT4 types are unsigned integers. The default value for all integer types is 0. The *UINT2 and *UINT4 types have the same restrictions as the *INT and *INT4 types.

Note: The %BINARY built-in function is for use with signed integers. There is no corresponding function for unsigned integers.
Related tasks
Examples: Define and create commands
Related information
Create Command (CRTCMD) command