Some QCMD tricks make a programmer's job faster and easier.
In all probability, if you are a programmer or system operator working on the AS/400, you've used the Command Entry panel at least occasionally. The Command Entry panel provides a full screen interface to OS/400 commands and messages. Best of all, it gives you several powerful function keys that make it easier to retrieve information and rerun commands without rekeying them. This article takes you on a quick tour of the features that make the Command Entry panel an excellent work area for programmers and system operators.
People in these positions frequently execute a wide variety of commands, making fast and easy access to command entry and previously entered commands a great timesaver. In addition, OS/400 usually reports run-time errors by sending one or more messages back to the requester. These messages are readily available on the Command Entry panel which makes it superior to a command line on a menu.
The Command Entry panel is displayed when you run a program called QCMD in library QSYS. As you execute commands, the panel itemizes the commands and any associated system messages. Initially, it contains nothing but a long command line and a bunch of function keys. 1 shows what the panel looks like when you CALL QSYS/QCMD. As user activity takes place, the panel begins to fill up with messages: commands appear as *RQS (request) messages preceded by a greater than (>) symbol, and system messages are itemized beneath the associated commands. See 2 for an example of a partially filled Command Entry panel.
The Command Entry panel is displayed when you run a program called QCMD in library QSYS. As you execute commands, the panel itemizes the commands and any associated system messages. Initially, it contains nothing but a long command line and a bunch of function keys. Figure 1 shows what the panel looks like when you CALL QSYS/QCMD. As user activity takes place, the panel begins to fill up with messages: commands appear as *RQS (request) messages preceded by a greater than (>) symbol, and system messages are itemized beneath the associated commands. See Figure 2 for an example of a partially filled Command Entry panel.
Cursor Maneuvers
You can move the cursor to any message on the Command Entry panel and press the Help key; the system displays full help text pertaining to that message. From there, as always, you can press F10 to display the job log.
You can also move the cursor to any message and press the F9 key to copy the command to the input field provided at the bottom of the panel. Once there, you can edit it any way you want, or you can press the F4 key to activate the prompter.
If you want to activate the prompter for a command that has been executed before, move the cursor to the line where the command is and press F4 directly; you do not have to copy it with F9 first. Once the prompter is activated, you can modify any of the parameters and run the command by pressing Enter. This feature can be very useful when you are testing and need to execute a command over and over.
More Function Keys
In addition to F4 and F9, you can also press F10 to display all messages. What this does is present something that is very similar to the job log, but it keeps the command line at the bottom, ready for you to enter another command. With this display activated, you can see messages that the system sent to programs you may have called from the Command Entry panel. Pressing F10 again toggles back to the normal view of Command Entry.
F11 turns the entire screen into a very long, continuous command line. You can use this special view to enter long commands without activating the command prompter. For example, the ADDMSGD command allows second-level message text of up to 3,000 characters. The command prompter won't accept more than 512 characters, even though ADDMSGD allows more.
You can also press the Roll keys to page through the messages. The Command Entry panel retains all messages since QCMD was first called. If a command you executed some time ago is not on the screen, press Roll Down (Page Up) repeatedly until you find it.
Finally, the Command Entry panel provides the usual F3 and F12 to end the program, F13 to go to the system SUPPORT menu and F16 to go to the system MAIN menu.
System/38 Users, Take Note
The Command Entry panel is old hat to System/38 users. What S/38 users may not realize is that the AS/400 has a S/38 environment, and you can activate a S/38 Command Entry panel by calling QSYS/QCL. The title changes to System/38 Command Entry and, as expected, it lets you execute S/38 commands.
While running QCL, S/38 commands such as Browse Physical File Member (BRWPFM), Display Output Queue (DSPOUTQ) and Terminate CPF (TRMCPF) are available. You can even use the F4 key to prompt them, but there's no help support and the prompter shown is the AS/400 prompter, not the vintage S/38 prompter.
Wait, There's More
Consider assigning QSYS/QCMD as the Attention-key handling program for your programmers and system operators, giving them instant access to the Command Entry panel at the touch of a single key. All you need to do is change their user profiles to ATNPGM(QSYS/QCMD).
The Command Entry panel is versatile and easy to use. As a fringe benefit, it can help you learn some of the nuances of CL. Once you get in the habit of entering commands manually, you'll begin to appreciate the simplicity of CL. After all, CL programs are nothing but a string of commands, most of which you can run from the Command Entry panel.
Using the Command Entry Panel
Figure 1 Empty Command Entry panel
Figure 1: Empty Command Entry Panel Command Entry MC PGMR Request level: 1 Previous commands and messages: (No previous commands or messages) Bottom Type command, press Enter. ===> _________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ F3=Exit F4=Prompt F9=Retrieve F10=Include detailed messages F11=Display full F12=Cancel F13=User support F16=System main menu
Using the Command Entry Panel
Figure 2 Filled Command Entry panel
Figure 2: Filled Command Entry Panel Command Entry MC PGMR Request level: 1 Previous commands and messages: > wrksplf > DSPUSRPRF USRPRF(QSECOFR) TYPE(*BASIC) > dspmsg qsysopr > CLRLIB LIB(QRPLOBJ) File QB61D6393B in library QRPLOBJ in use. Cannot delete some objects in library QRPLOBJ. > strseu $malern/source x clp text('Sample CL program') Member X in file $MALERN/SOURCE changed with 3 records. > sbmjob cmd(crtclpgm $malern/x $malern/source) job(x) Job 036214/MALERN/X submitted to job queue MALERN in library MGTLIB. Bottom Type command, press Enter. ===> _________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ ______________________________________________________________________ F3=Exit F4=Prompt F9=Retrieve F10=Include detailed messages F11=Display full F12=Cancel F13=User support F16=System main menu
LATEST COMMENTS
MC Press Online