Starter Kit- Chapter 32 System iNetwork (formerly iSeries Network)
Home Site Map Contact Us My Profile Log In Join Now!
Info Centers
 Forums

 Tech Center

 News & Analysis

 Solution Center

 UK Centre
Popular Spots
 25th Anniversary

 Article Archive

 ProVIP Center (Club Tech)

 Code

 System i DocFinder

 Essential Guides

 Blogs

 Wikis

 e-Learning

 Webcasts

 Podcasts

 System i Jobs

 Events
Products
 i5 Route Finders

 Learning Center (Store)

 Product Directory
Network Poll
Determining a programmer's desktop requirements is not a black-and-white proposition, but matching equipment to programmer type can help productivity. Which "programmer type" are you?
Vote Now!
Network Memberships
 See Membership Levels

 Free E-Mail Newsletters

 Free RSS Feeds

 Subscribe/Join

 Upgrade Now

 Renew Now
About Us
 About the Network

 Network Publications

 Tech Editor Profiles

 Editorial Calendar

 Contact Us

 Subscribe

 Media Kit (PDF)

 Write For Us


System iNetwork November Sponsor





        System iNetwork November Sponsor


Home » Starter Kit » TOC » Chapter 32
  AS/400-iSeries Starter Kit


Chapter 32 - OS/400 Commands

OS/400 commands -- friend or foe? That's the big question for anyone new to the AS/400. It is 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 are ever going to remember them all. You might easily decide that the procedures you've already memorized on another system are certainly better and fail to see why IBM would think the OS/400 commands could possibly be helpful!

Well, after recently trying to navigate my way around an HP3000, I can empathize with you. I kept thinking, "Why didn't Hewlett-Packard think to provide the WRKSPLF (Work with Spooled Files) command, or why not say DSPFD (Display File Description) instead of this 'LISTF ,2' stuff?" Anyway, after stumbling around for days, calling everyone I could think of, and scouring the books for information, I finally managed to memorize a few of the needed commands and complete the "short" job I had set out to do. So if you get frustrated when you find the procedures you are accustomed to have been twisted into something that seems foreign, remember that being uncomfortable doesn't mean you're incompetent; it only makes you feel that way!

With that said, and realizing that many of you need to master the AS/400 sooner or later, let me introduce OS/400 commands and give you a few helpful tips and suggestions for customizing system commands to make them seem more friendly.

Commands: The Heart of the System

The command is at the heart of the AS/400 operating system. Whether you are 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 are executing a command. Let me give you a couple of examples.

Figure 32.1 shows the AS/400 User Tasks menu. Next to each menu option I have added the command the system executes when you select that option. You can simply key in the command to achieve the same results.

In Figure 32.2 you see the familiar Work with Output Queue display. Below the screen format, I have listed the available options and the command the system executes for each. For instance, if you enter a "6" next to a spooled file entry on the list, the system releases that spooled file. If you are familiar with the system commands, you can type in RLSSPLF (Release Spooled File), prompt it, and fill in the appropriate parameters to accomplish the same thing. Obviously, typing in the RLSSPLF command is much more time consuming than entering a "6" in the appropriate blank. However, this example is not typical of all OS/400 commands. In many cases, it's quicker and easier to key in the command than it is to use 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 worth learning.

Before I continue with this chapter, let me say something about how system commands are organized and named. OS/400 commands consist basically of a verb and a noun (e.g., CRTOUTQ -- Create Output Queue), and more than two-thirds of the existing commands are constructed using just 10 verbs (CRT, CHG, DLT, ADD, RMV, DSP, WRK, CPY, STR, and END). This is good news if you are worried about remembering all the commands. I recommend that 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 upon each object type. For example, you can't delete a job, but you can cancel one.

For help identifying and using OS/400 commands, try using one or more of the following resources:

  • 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", where you fill in the xxx with either a verb or an object (e.g., GO CMDPTF for PTF-related commands, GO CMDWRK for "work with" commands). OS/400 will present you with a list of those commands.
  • Type a command on the command line and press F1 (Help). OS/400 offers online help for all CL commands.
  • Execute the SLTCMD (Select Command) Command to find commands using a generic name (e.g., WRK*, STR*).
  • If you are on V2R3 (or beyond), you can enter 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 begin with the same letters you specify before the asterisk.
  • If you are on V2R3 (or beyond), use InfoSeeker. You access InfoSeeker by pressing F11 on any Help Display Panel, by typing STRSCHIDX (Start Search Index) on a command line and pressing Enter, or by selecting option 20 from the Information Assistant menu (to get this menu, type "GO INFO"). InfoSeeker helps you find further command help and related information. Refer to the IBM reference guide Programming: Reference Summary (SX41-0028).

Tips for Entering Commands

By putting a little time and effort into learning a few phrases in this new language, you'll be comfortable and productive with day-to-day tasks on the AS/400. Once you've become acquainted 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. Following these tips for entering commands will help ensure correct syntax and get you up to speed:

  • Be sure to enter values for required parameters.
  • Specify values for positional parameters unless you want to use the default values.
  • When entering parameter values positionally (i.e., without keywords), key them in the same order as they appear in the command syntax diagram. If you exceed the number of allowed parameters, an error message is issued. The number of allowed positional parameters is designated in the syntax diagram by a "P" in a box. If the symbol does not appear in the syntax diagram, you can code all parameters positionally.

Keeping the above 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 Object is a required parameter. Now press F11, and you will see the screen shown in Figure 32.4. Notice that the keywords appear beside each field (e.g., OBJ for object name and OBJTYPE for object type). The OBJ keyword requires a qualified value, which means that you must supply the name of the library in which the object is found. The default value *LIBL indicates that if you don't enter a specific library name, the system will search for the object in the job's library list. Notice that the keyword OUTPUT is not in bold, showing that it is an optional parameter. The default value for OUTPUT is an asterisk (*), which instructs the system to display the results of the command on the screen.

Now you can key in the values QGPL and QSYS for the object name and the library name, respectively, and the value *LIB for the OBJTYPE parameter. Then press Enter, and the screen displays the object description for library QGPL, which exists in library QSYS.

Now, using only the command line, type in the same command as follows:

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 have entered, in the correct order, values for the two required parameters and the 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 would get the description specified by the default value (*BASIC).

Most of the time you will 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 WRKOUTQ just to enter the output queue name, or to enter "WRKOUTQ outq_name"? Should you prompt the WRKJOBQ (Work with Job Queue) command just to enter the job queue name, or should you simply enter "WRKJOBQ job_name"? In both cases you will save yourself a step (or more) if you simply enter the 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, take a few minutes to look over the CRTDUPOBJ command description in Volume 3 of IBM's Programming: Control Language Reference manual. Then create a library to hold all your new customized versions of IBM-supplied commands. Don'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. You should name your new library USRCMDLIB, or CMDLIB, or anything that describes the purpose of the library; and you should include the new library in the library list of those 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., by an initial character string common to a group of objects, followed by an asterisk), or all objects in a particular library, or multiple object types. To rename the WRKOUTQ command, enter

CRTDUPOBJ WRKOUTQ QSYS *CMD USRCMDLIB 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(USRCMDLIB) NEWOBJ(WO)

Either of these commands places the new command (WO) into library USRCMDLIB. 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.

Modifying Default Values

The final touch for tailoring commands is to modify certain parameter default values when you know that you will 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 parameter as (1000 1000 999). Or you may want the SHARE parameter to contain the value *YES rather than the IBM-supplied default *NO. You can change these defaults by 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 modifying the default values of IBM-supplied commands is to use the CHGCMDDFT (Change Command Default) command. Take a few minutes to read the command description in IBM's Programming: Control Language Reference, Volume 2. CHGCMDDFT simply modifies the default values that will be used when the command is processed. For instance, to make the changes mentioned above for the CRTPF (Create Physical File) command, you would type

CHGCMDDFT CMD(CRTPF) NEWDFT('SIZE(1000 1000 999) SHARE(*YES)')

You could use CHGCMDDFT to enhance the WO command you created earlier. Suppose that 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 be the name of your own output queue? Then, rather than having to type

WO your_outq

you can simply type "WO" (of course, this personalized command should only exist 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 modify 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.

When 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 (e.g., 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 to evaluate the risk of changing certain default values.

You can modify your user profile attribute USROPT 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 modify this user profile attribute, someone with the proper authority should enter the CHGUSRPRF (Change User Profile) command as follows:

CHGUSRPRF user_profile USROPT(*CLKWD)

For more information about the USROPT keyword, see IBM's Programming: Control Language Reference.

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


Starter Kit for the AS/400, 2nd Edition
Copyright 1994 by Duke Press
DUKE COMMUNICATIONS INTERNATIONAL
Loveland, Colorado

All rights reserved. No part of this book may be reproduced in any form by any electronic or mechanical means (including photocopying, recording, or information storage and retrieval) without permission in writing from the publisher.

It is the reader's responsibility to ensure procedures and techniques used from this book are accurate and appropriate for the user's installation. No warranty is implied or expressed.

This book was printed and bound in the United States of America.
Second Edition: April 1994

ISBN 10882419-09-X



  Sponsored Links   Featured Links


Penton Technology Media
Connected Home | SQL Server Magazine | Windows IT Pro
Report Bugs | Contact Us | Comments/Suggestions | Terms & Conditions | Privacy Policy | Trademarks
See Membership Levels | Subscribe | Free E-mail Newsletters | Free RSS Feeds | My Profile | Upgrade Now | Renew Now

Copyright © 2008 - Penton Technology Media
Penton Media
System i is a trademark of International Business Machines Corporation and is used by Penton Media, Inc., under license. SystemiNetwork.com is published independently of International Business Machines Corporation, which is not responsible in any way for the content. Penton Media, Inc., is solely responsible for the editorial content and control of the System iNetwork.