Admin Alert: Searching for Elusive OS/400 Green-Screen Commands
August 18, 2004 Joe Hertvik
In spite of many recent graphical enhancements to OS/400, sometimes the fastest way to finish your work is by running an old-fashioned 5250 green-screen command. But the problem with green-screen commands is that you need to know the exact command name in order to run it, and executing the right command sometimes depends on how good your memory is. Fortunately, IBM offers a few easy to remember green-screen utilities for finding the right command at the right time.
The first place to stop during your command search is at the Major Command Groups menu. You can reach the MCG menu simply by pressing the F4 key from any OS/400 command line. The menu lets you browse through all the commands that are listed under 23 different groupings. These groupings include menu options for finding and running all the save and restore commands (option 6), print commands (option 10), and program commands (option 13). Each command group menu also contains a list of related commands, such as displaying all the tape commands as a menu item inside the save and restore commands menu. The MCG menu is a good reference for finding that one command you may have forgotten.
If you don’t want to search through the Major Command Groups menu, you can use Select Command (SLTCMD). This command is good for finding and executing commands when you know the command name you want to execute but not its location, or when you only know part of the command name. For example, I created a command called DSPQSYSOPR in my shop for displaying the system operator message queue in a certain way. If that command wasn’t in my library list, I could find and execute it by running the following SLTCMD command:
SLTCMD CMD(*ALL/DSPQSYSOPR)
In this case, SLTCMD would search every library on my iSeries or AS/400 (as designated by the *ALL part of the Command parameter (CMD) until it found all the commands named DSPQSYSOPR in my system. SLTCMD produces a list containing the target commands, and I can prompt and run any command in that list by placing a 1 in front of the command’s entry and pressing Enter. Note that executing the command from the SLTCMD list is the same as typing in the command name and then pressing the F4 key for parameter prompting.
SLTCMD can also be used to produce a wildcard list of commands that begin with a certain string. If, for example, I knew I wanted to work with OS/400 documents (DOC) but didn’t know the exact command to use, I could enter SLTCMD like this:
SLTCMD CMD(WRKDOC*)
And SLTCMD would show me all the commands in my library list that start with the string WRKDOC. I could then select the one I wanted to execute, and I’d be on my way. Also notice that you can use SLTCMD to search for commands in a specific library or in a number of different libraries by changing the library part of the CMD parameter. Using the WRKDOC* example, we can look for our target commands in a number of different places just by manipulating the libraries we ask SLTCMD to search through. Here are some of the different SLTCMD search permutations we could run:
- SLTCMD CMD(*ALL/WRKDOC*) to look in all libraries on the system.
- SLTCMD CMD(*LIBL/WRKDOC*) to look in the user library list, which is the default setting.
- SLTCMD CMD(*CURLIB/WRKDOC*) to look only in the user’s current library.
- SLTCMD CMD(*USRLIB/WRKDOC*) to look in the user part of the library list.
- SLTCMD CMD(*ALLUSR/WRKDOC*) to look in all user libraries on the system.
- SLTCMD CMD(LIBNAME/WRKDOC*) to look only in the specific library you hard-coded into the command.
SLTCMD is also available as option 3 from the Major Command Groups menu.
The final place to search for specific commands is the Verb Commands menu, which you can reach by typing GO VERB at any OS/400 command line (this menu is also available as option 2 of the Major Command Groups menu). The Verb Commands menu is handy for finding commands based on the OS/400 verb used in the command’s name (like WRK, ADD, or DLT). So if you wanted to find a command to copy a library (which starts with the literal CPY), you could go to the Verb Commands menu and select option 18, Copy Commands. For Delete Commands (DLT), you would select option 25, and for commands that start with WRK (work), you would select option 88, Work Commands. In OS/400 V5R2, there are up to 88 verb categories listed on the Verb Commands menu. However, to find a specific command, it may be quicker to use the Major Command Groups menu, the Subject Commands menu, or the Select Command command.