CL Programming

Step Description

Command Definition Statements

The command definition statements contain the information that is necessary to prompt the work station user for input, to validate that input, and to define the values to be passed to the program that is called when the command is run.

Command definition statements may exist in any file supported as input to the CRTCMD command. For example, source entry utility (SEU) source files, diskette files, and other device files may contain command definition statements. They are usually entered in a source file by SEU. Table 9-1 contains the statements used for defining commands.

Table 9-1. Statements for Defining CL Commands

Statement Type Statement Name Description
Command CMD Specifies the prompt text, if any, for the command name
Parameter PARM Defines a parameter or key parameter for a command
Element ELEM Defines an element in a list used as a parameter value
Qualifier QUAL Defines a qualifier of a name used as a parameter
Dependent DEP Defines the relationship among parameters
Prompt Control PMTCTL Defines the conditions under which certain parameters are prompted.

Create Command (CRTCMD) Command

The CRTCMD command processes the command definition statements to create the command definition object. The CRTCMD command may be run interactively or in a batch job.

Command Definition Object

The command definition object is the object that is checked by a system program to ensure that the command is valid and that the proper parameters were entered.

Validity Checking

The system performs validity checking on commands. You may also write your own validity checking program although it is not required.

The validity checking performed by the system ensures that:

The system performs validity checking when:

If you need more validity checking than the system performs, you can write a program called a validity checking program (see Writing a Validity Checking Program) or you can include the checking in the command processing program. You specify the names of both the command processing and validity checking programs on the CRTCMD command.

If a command has a validity checking program, the system passes the command parameter values to the validity checking program. This happens before the system calls the command processing program. A validity checking program runs during syntax checking during the following conditions:

When the program finds an error, the user receives a message to allow immediate correction of errors. The command processing program can assume that the data that is passed to it is correct. Refer to Writing a Validity Checking Program for further information on writing validity checking programs.

Prompt Override Program

You can write prompt override programs to supply current values for parameter defaults when prompting the command. For example, prompt override programs are frequently used on Change commands to supply values for parameters with a default value of *SAME. See Using Key Parameters and a Prompt Override Program for more details. A prompt override program is optional.

Providing Help Information for Commands

To provide online help information for your command, you can use help panel groups. A panel group is an object with type *PNLGRP. For more information on help panel groups, see the Application Display Programming Link to PDF book.

Command Processing Program

The command processing program (CPP) is the program that the command analyzer calls to perform the function requested. The CPP can be a CL program, another HLL program, or a REXX procedure. For example, it can be an application program that your command calls, or it can be a CL program or REXX procedure that contains a system command or series of commands.

The CPP must accept the parameters as defined by the command definition statements.

Command Exit Programs and Independent ASPs

Any exit program, including the command processing program, validity checking program, prompt override program, choices program, or prompt control program, needed by a command must be in the same independent auxiliary storage pool (ASP) as the command, or in the system ASP (ASP 1), or in a basic ASP (ASPs 2-32). The command must not be in one independent ASP and the exit programs in another independent ASP. Problems could occur when running the command if the independent ASP where these exit programs reside is not available (for example, if the independent ASP device is varied off).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]