Sie sind auf Seite 1von 7

Starter Kit for the IBM iSeries & AS/400

by Gary Guthrie and Wayne Madden


29th Street Press. (c) 2001. Copying Prohibited.

Reprinted for Gnaneshwar Gatla, IBM


gnaneshwar@in.ibm.com
Reprinted with permission as a subscription benefit of Books24x7,
http://www.books24x7.com/

All rights reserved. Reproduction and/or distribution in whole or in part in electronic,paper or


other forms without written permission is prohibited.

StarterKitfortheIBMiSeries&AS/400

Chapter 32: OS/400 Commands


OS/400 commands friend or foe? That's the big question for anyone new to the iSeries. It's certainly understandable to
look at the IBM-supplied system commands and wonder just how many there are, why so many are needed, and how
you're ever going to remember them all!
The good news is that you don't need to remember all these commands. You do need a modicum of familiarity with them,
though. In this introduction to OS/400 commands, we give you a few helpful tips and suggestions for using and customizing
system commands.
Commands: The Heart of the System
The command is at the heart of the iSeries operating system. Whether you're working with an output queue, creating an
object, displaying messages, or creating a subsystem, you are using an OS/400 command. When you select an option
from an OS/400 menu or from a list panel display, you're usually executing a command. Let us give you a couple of
examples.
Figure 32.1 shows the iSeries USER (User Tasks) menu. Next to each menu option, we've listed the command that the
system executes when you select that option. You can simply key in the named command to achieve the same results as
the menu option.

Figure 32.1: User Tasks Menu and System Commands Panel


Figure 32.2 shows the familiar Work with Output Queue display. After the screen format, we've listed the available options
and the command that the system executes for each one. For instance, if you enter 6 (Release) next to a spooled file entry
on the list, the system releases that spooled file. If you're familiar with the system commands, you can enter RlsSplF on a
command line (to execute the Release Spooled File command), request prompting for the command, and fill in the
appropriate parameters to accomplish the same thing. Obviously, typing in the RlsSplF command is much more timeconsuming than entering a 6 in the appropriate blank. However, this example isn't typical of all OS/400 commands. In many
cases, keying in the command is quicker and easier than using the menus. To know which technique to use, it's helpful to
have a firm grasp of how commands are organized and how they can be used and to know which commands are important
to remember.

Page 2 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

StarterKitfortheIBMiSeries&AS/400

Figure 32.2: Work with Output Queue Panel


Before we continue with this chapter, let us say something about how system commands are organized and named.
OS/400 commands consist basically of a verb and a noun for example, the CrtOutQ command is made up of the verb
"Create" and the noun "Output Queue." More than two-thirds of the existing commands are constructed using just 10 verbs:
Add, Chg, Cpy, Crt, Dlt, Dsp, End, Rmv, Str, and Wrk. This is good news if you're worried about remembering commands.
We recommend you first familiarize yourself with the various objects that can exist on the system. Once you understand
most of those objects, you can quickly figure out what verbs can operate on each object type. For example, you can't
delete a job, but you can end one.
For help identifying and using OS/400 commands, try using one or more of the following resources:
n

On any command line, press F4 (Prompt). OS/400 will present you with a menu of the major command groups. You can
choose menu options to find and select the command you need.
On any command line, type Go Cmdxxx, filling in the xxx with either a verb or an object for example, Go CmdPTF
for PTF-related commands or Go CmdWrk for "work with" commands. OS/400 will present you with a list of those
commands.
Type a generic name directly on the command line (e.g., Wrk*, Str*, CrtDev*) and press Enter. OS/400 will present you
with a list of commands that start with the same letters you specified before the asterisk.
Type a command on the command line, and press Fl (Help). OS/400 offers online help for all system commands.
NoteYou can also execute the SltCmd (Select Command) command to find commands using a generic name (e.g., Str*,
Wrk*). We don't recommend using this command, though; it's too easy to accidentally type D instead of S as the
first character in the command that's right, DltCmd Wrk*! Oops!!

Page 3 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

StarterKitfortheIBMiSeries&AS/400

Tips for Entering Commands


Put a little time and effort into learning a few phrases in this new language, and you'll be comfortably productive with dayto-day tasks on the iSeries. Once you've acquainted yourself with some of the most frequently used commands, it's often
easier to key them in on the system command line than it is to go through the menus. Follow these tips for entering
commands to help ensure correct syntax and get up to speed:
n

Be sure to enter values for required parameters.


When entering parameter values positionally (i.e., without keywords), key them in the same order as they appear in the
CL documentation's command syntax diagram. If you exceed the number of allowed parameters, the system issues an
error message. The syntax diagram uses a P in a box to designate the number of allowed positional parameters. If this
symbol doesn't appear in the syntax diagram, you can code all parameters positionally.
Specify values for positional parameters unless you want to use the default values.

Keeping these guidelines in mind, let's practice a few commands. First, consider the DspObjD (Display Object Description)
command. Type DspObjD and press F4 to prompt the command. In the resulting screen (Figure 32.3), the line next to
"Object" will be in bold, indicating that parameter Object is a required parameter.

Figure 32.3: DspObjD Command Panel


Now press F11, and you'll see the screen shown in Figure 32.4.

Page 4 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

StarterKitfortheIBMiSeries&AS/400

Figure 32.4: DspObjD Command Panel with Keywords


Notice that the keywords now appear beside each field (e.g., OBJ for object name, OBJTYPE for object type). The Obj
keyword requires a qualified value, which means you must supply the name of the library in which the object is found. The
default value *LibL displayed on the screen indicates that if you don't enter a specific library name, the system will search
for the object in the job's library list.
You'll also see that the entry fields for keywords DETAIL and OUTPUT do not appear in bold; this means they are optional
parameters. The default value for Detail is *Basic, indicating that basic object information should be displayed. The default
value for Output is * (asterisk), which instructs the system to display the results of the command on the screen.
Now, key in the values QGPL and QSys for the object name and library name, respectively, and enter the value *Lib for the
ObjType parameter. Press Enter, and the screen will display the object description for library QGPL, which exists in library
QSys.
Next, using only the command line, type in the same command as either
DspObjD QSys/QGPL *Lib

or
DspObjD QGPL *Lib

Either command meets the syntax requirements. Keywords aren't needed because all the parameters used are positional
and the order of the values is correct. Suppose you type
DspObjD QGPL *Lib *Full

Will this work? Sure. In this example, you've entered, in the correct order, values for the two required parameters and a
value (*Full) for the optional, positional parameter (Detail).
What if you want to direct the output to the printer and you type
DspObjD QGPL *Lib *Full *Print

Will this work? No! You have to use the keyword (Output) in addition to the value (*Print), because Output is beyond the
positional coding limit.
Let's say you skip *Full and just enter
DspObjD QGPL *Lib Output(*Print)

Because you haven't specified a value for the positional parameter Detail, you'll get the description specified by the default
value (*Basic).
Most of the time, you'll probably prompt commands, but learning how to enter a few frequently used commands with
minimal keystrokes can save you time. For example, which would be faster: to prompt the WrkOutQ (Work with Output
Page 5 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

StarterKitfortheIBMiSeries&AS/400

Queue) command just to enter the output queue name or to enter


WrkOutQ OutQName

Should you prompt the WrkJobQ (Work with Job Queue) command just to enter the job queue name, or should you simply
enter
WrkJobQ JobQName

In both cases, you'll save yourself a step (or more) by simply entering the entire command.
Customizing Commands
Taking our discussion one step further, let's explore how you might create friendlier versions of certain useful system
commands. Why would you want to? Well, some (translation: "many") IBM-supplied commands are long, requiring multiple
keystrokes. You might want to shorten the commands you use most often. For example, you could shorten the command
WrkSbmJob (Work with Submitted Jobs) to WSJ or Jobs. The command WrkOutQ could become WO, and the command
DspMsg (Display Messages) could become Msg. How can you accomplish this without renaming the actual IBM commands
or having to create your own command to execute the real system command? Easy! Just use the CrtDupObj (Create
Duplicate Object) command.
Before trying this command, first create a library to hold all your new customized versions of IBM-supplied commands.
CautionDon't place the new command in library QSys or any other system-supplied library. New releases of OS/400
replace these libraries, and your modified command will be lost when that happens. Give your new library a
name that describes the library's purpose (e.g., AltSys), and include (before QSys) the new library in the
system portion of the library list of those users who will use your modified commands.
When the destination library is ready, use the CrtDupObj command to copy the commands you want to customize into the
new library. CrtDupObj lets you duplicate individual objects, or you can duplicate objects generically (i.e., using an initial
character string common to a group of objects followed by an asterisk), all objects in a particular library, or multiple object
types.
To rename the WrkOutQ command, you could enter
CrtDupObj WrkOutQ QSys *Cmd ALtSys WO

In this example, WrkOutQ, QSys, and *Cmd are values for required parameters that specify the object, the originating
library, and the object type, respectively. If you prompt for the parameters, enter
CrtDupObj Obj(WrkOutQ)
FromLib(QSys)
ObjType(*Cmd)
ToLib(AltSys)
NewObj(WO)

+
+
+
+

Either of these commands places the new command (WO) into library AltSys.
When you duplicate an object, all the object's attributes are duplicated. This means that the command processing program
for WO is the same as for WrkOutQ, so the new command functions just the same as the IBM-supplied command.
Changing Default Values
The final touch for tailoring commands is to modify certain parameter default values when you know you'll normally use
different standard values for those parameters. You may want to change default values for the CrtXxx (Create) commands
especially. For example, for every physical file created, you may want to specify the Size (Member size) parameter as
(1000 1000 999). Or you may want the WaitRcd (Maximum record wait time) parameter to contain the value 30 rather than
the IBM-supplied default value of 60. You can change these defaults using one of two methods.
The first method requires that everyone who uses a command remember to specify the desired values instead of the
defaults for certain parameters. Although you can place such requirements in a data processing handbook or a standards
guide, this method relies on your staff to either remember the substitute values or look up the values each time they need
to key them in.
The other method for changing the default values of IBM-supplied commands is to use the ChgCmdDft (Change Command
Default) command. ChgCmdDft simply changes the default values that will be used when the command is processed. For
Page 6 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

StarterKitfortheIBMiSeries&AS/400

instance, to make the changes mentioned above for the CrtPF (Create Physical File) command, you'd type
ChgCmdDft Cmd(CrtPF)
+
NewDft('Size(1000 1000 999) WaitRcd(30)')

You could also use ChgCmdDft to enhance the WO command we created earlier. Suppose you usually use the WO
command to work with your own output queue. Why not change the default value of *All for the OutQ parameter to he the
name of your own output queue? Then, rather than having to type
WO YourOutQ

you could simply type WO (of course, this personalized command should exist only in your library list). If you want to work
with another output queue, you can still type in the queue name to override the default value. See? Commands can be fun!
To change system command parameter defaults using the ChgCmdDft command, you should duplicate the command into a
different library. Then change the command defaults and, if you have retained the CL command names rather than
renaming the commands, list the library before QSys on the system library list.
TipWhen you use the ChgCmdDft or CrtDupObj command to customize CL commands, you should create a CL source
program that performs those changes. Then whenever a new release of OS/400 is installed, you should run the CL
program, thus duplicating or modifying the new version of the system commands. The system commands on the
new release might have new parameters, different command processing programs, or new default values.
Using ChgCmdDft is an effective way to control standards. However, you should be cautious when using this command
because it affects all uses of the changed command. (For example, a vendor-supplied software package might be affected
by a change you make.) You might want to use a good documentation package to find all uses of specific commands and
evaluate the risk of changing certain default values.
You can change your user profile attribute UsrOpt (User options) to include the value *CLKwd if you want the CL keywords
to be displayed automatically when you prompt commands (rather than having to press F11 to see them). To change this
attribute, someone with the proper authority should enter the ChgUsrPrf (Change User Profile) command as follows:
ChgUsrPrf UserProfile UsrOpt(*CLKwd)

Some users, notably some programmers, find this option useful.


The iSeries provides a function-rich command structure that lets you maneuver through the operations of your system. We
don't happen to believe that everyone should be able to enter every command without prompting or using any keywords.
But we're convinced that having a good working knowledge of the available OS/400 commands will not only help you save
time but also make you more productive on the system.

Page 7 / 7
Reprintedforibm\gnaneshwar@in.ibm.com,IBM

29thStreetPress,GaryGuthrieandWayneMadden(c)2001,CopyingProhibited

Das könnte Ihnen auch gefallen