CL command validity checking

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

The validity checking performed by the system ensures that:

  • Values for the required parameters are entered.
  • Each parameter value meets data type and length requirements.
  • Each parameter value meets optional requirements specified in the command definition of:
    • A list of valid values
    • A range of values
    • A relational comparison to a value
  • Conflicting parameters are not entered.

The system performs validity checking when:

  • Commands are entered interactively from a display station.
  • Commands are entered from a batch input stream using spooling.
  • Commands are entered into a database file through the source entry utility (SEU).
  • A command is passed to the QCMDEXC, QCMDCHK, or QCAPCMD program by a call from a high-level language (HLL).
  • A CL module or original program model (OPM) program is created.
  • Commands are run by a CL procedure or program or a REXX procedure.
  • A command is run using the C language system function.

If you need more validity checking than the system performs, you can write a program called 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 running the command.
  • When using the source entry utility (SEU) to enter commands into a CL source member and the programmer uses constants instead of variables for the parameters that are specified on the command.
  • When compiling a CL source program that uses constants instead of variables for all the parameters that are specified on the command.

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.