Previous Topic: Command processing programs (CPP)

Next Topic: Prompt Override Programs

Command Validity Checking Programs

A validity-checking program is a user-defined subprogram, which can be associated with a user-defined command. The validity checker will be called by the final stage of execution of the OS/400 command prompter, before it hands over control to the CPP—it can be used to carry out any user-defined validation of the command parameters.

If used at all, validity checking programs should only carry out limited validation; for instance, any cross-checking of parameters that cannot be achieved with the CL ‘Dependency definition’ (DEP) command definition statement. This should only be necessary when checking the components of lists and qualified names.

Validity checkers should not check for the existence of objects or other entities, nor should they be used to invoke selection functions. This is because the validity checker is invoked whenever the OS/400 command prompter or syntax checker is invoked for the command, even if the command is not executed.

Validity checking programs should resend diagnostics, using the standard OS/400 message - CPD0006 in QCPFMSG.

If validity checking fails, the errors should be retransmitted to the invoking program (which is always the command prompter) as diagnostics; and an escape message (CPF0002) should be sent to return control.

Example of code to resend a diagnostic to the prompter: