CL procedures consist of CL commands, and the commands themselves consist of the command statement, parameters, and parameter values.
Parameter values may be expressed as variables, constants, or expressions. A variable is a named changeable value that can be accessed or changed by referring to its name. Variables can be used as substitutes for most parameter values on CL commands. When a CL variable is specified as a parameter value and the command containing it is run, the value of the variable is used as the parameter value. Every time the command is run, a different value can be substituted for the variable. Variables and expressions can be used as parameter values only in CL procedures and programs.
Variables are not stored in libraries; they are not objects; and their values are destroyed when the procedure that contains them is no longer active. The use of variables as values gives CL programming a special flexibility, because this allows high-level manipulation of objects whose content may change by specific applications. You might, for instance, write a CL procedure to direct the processing of other programs or the operation of several workstations without specifying which programs or workstations are to be controlled. The system identifies these as variables in the CL procedure. You can define (specify) the value of the variables when running the CL procedure.
In addition to the uses discussed in this section, variables can be used to:
CRTPF FILE(DSTPRODLB/&FILE) CRTPF FILE(&LIB/&FILE)
Variables cannot be used to change a command name or keyword or to specify a procedure name for the CALLPRC command. Command parameters, however, can be changed during the processing of a CL procedure through the use of the prompting function.
It is also possible to assemble the keywords and parameters for a command and process it using the QCAPCMD API or QCMDEXC API.