Years ago, only IBM could create commands that accepted other commands as parameters. For example, the IF command in CL allows you to put another CL command on the THEN parameter. Not only does this capability allow you to specify a CL command, it also allows you to do what's called second-level prompting.
IBM added a special data type for parameters that supports CL commands and second-level prompting. The data type is *CMDSTR, and it's used in this week's featured command, SAVOBJIFS. (See "Back Up to the IFS.")
Here is the specific command definition statement for the SAVCMD parameter:
PROMPT('SAVxxx command to run')
For the most part, this statement looks just like any other command definition statement, but the data type is *CMDSTR. The *CMDSTR parameter type allows the user to type in any valid CL command. The command is not run by the parameter; instead, it is simply passed as a character string parameter to the command's command processing program. But the system does allow the user to enter the command and prompt the command, and it automatically syntax checks the command.
Previously, there was a command definition parameter type of *CMD. Many people, including yours truly, attempted to create commands using this parameter--but alas, this was reserved for IBM-only commands. I believe it was used when IBM created the IF, ELSE, and MONMSG commands.
A few years ago, IBM began abandoning CL commands in favor of the GUI interface in Client Access. Fortunately, they have since repented and now continue to create new commands and support the CL language itself.
As you create your own CL commands, remember the *CMDSTR parameter type so that when a design calls for a CL command, you'll have the tools to make it happen.
Bob Cozzi is a programmer/consultant, writer/author, and software developer. His popular RPG xTools add-on subprocedure library for RPG IV is fast becoming a standard with RPG developers. His book The Modern RPG Language has been the most widely used RPG programming book for more than a decade. He, along with others, speaks at and produces the highly popular RPG World conference for RPG programmers.
LATEST COMMENTS
MC Press Online