Reputation: 763
I need to create an AS/400 command. Based on the requirement, it has two parameter, say A and B, which cannot be filled in the same time. Both will be displayed when F4 is pressed to prompt, but only one can be filled at a time. If both are filled an error message should appear saying this is invalid. Can someone tell me how to create a command like this? What do I need to specify in the CMD source to achieve it?
Upvotes: 4
Views: 2787
Reputation: 7648
The CMD source only has rudimentary ability to perform validity checking. Typically, end user business rules are enforced by a validity checking program. See CRTCMD VLDCKR(). The VCP is very similar to the CPP, except if the command fails validity checking, your VCP sends a *DIAG message to the caller with the details of the reason, and a CPF0002 *ESCAPE message to the caller to tell it the command did not run.
Upvotes: 0
Reputation: 41208
Use the DEP command definition statement to control the parameters.
CMD PROMPT('TEST')
PARM KWD(A) TYPE(*CHAR) PROMPT('A')
PARM KWD(B) TYPE(*CHAR) PROMPT('B')
DEP CTL(*ALWAYS) PARM(A B) NBRTRUE(*EQ 1)
Upvotes: 8