Customizing IBM Commands


Many parameters have default values. If you do not specify a parameter in a command, the command will run as if you had specified the default value. The Display Job (DSPJOB) command provides information about a job. If you do not tell which job you want to know about, DSPJOB assumes you want to display your current job.

Although IBM's choice for default values is sensible, the designers of CL cannot possibly foresee all the environments in which the i5 is used. The result is that, in some cases, the default parameters are not what you would want them to be.

Tip 

To change the default value of a parameter, run the Change Command Default (CHGCMDDFT) command.

Fortunately, you can change the default value for any parameter in any command if:

  • The parameter already has a default value. You cannot assign a default value to a parameter that is defined as mandatory, nor to one that shows no parameter at all when you invoke the command prompter.

  • The parameter is not a list parameter (a parameter that accepts two or more values).

The Simple Approach

The simplest way to change an IBM-supplied command is to change the command itself in QSYS. For example, suppose you often use the Work with Output Queues (WRKOUTQ) command to display the contents of output queue QPRINT. WRKOUTQ's OUTQ parameter defaults to *ALL which takes long to process and is not what you want.

You can change WRKOUTQ's default for the OUTQ parameter, so that QPRINT is assumed if no value is entered. This change allows you to work with QPRINT by typing WRKOUYQ and pressing Enter. To change the default:

      CHGCMDDFT CMD(QSYS/WRKOUTQ) NEWDFT('OUTQ(QPRINT)') 

This method works, but it has one serious disadvantage. When you upgrade to a new release of i5/OS, or sometimes even when you apply certain PTFs, you will lose your new default values and the system will not alert you to it. If this is not a problem for you, it is okay to change QSYS commands directly. If it is a problem, read the Learned Approach section.

The Learned Approach

A safer approach to changing command defaults is to first make a copy of the original QSYS command and then change the copy, not the original. Here is the process:

  1. Create a user library where you can place your copies of QSYS objects. You might name it ALTQSY, for Alternative QSYS:

          CRTLIB LIB(ALTQSYS) TEXT('Alternative QSYS') 
  2. Place this library ahead of QSYS in the system portion of the library list. This change guarantees that your copies of the objects will be used instead of the QSYS originals:

          WRKSYSVAL SYSVAL(QSYSLIBL) 
  3. Select option 2.

  4. Insert ALTQSYS before QSYS.

  5. Copy the QSYS command you want to change into ALTQSYS:

          CRTDUPOBJ OBJ(WRKOUTQ) OBJTYPE(*CMD) FROMLIB(QSYS) +      TOLIB(ALTQSYS) 
  6. Change the copy's defaults as you see fit:

          CHGCMDDFT CMD(ALTQSYS/WRKOUTQ) +      NEWDFT('OUTQ(QPRINT)') 

When you update to a new release, you will need to clear the ALTQSYS library, copy the commands from QSYS, and reapply the changes.

Document all the changes you make to command parameters in a CL program. For each command with changed defaults, include the section of code shown in Figure 9.7 in the CL program.

image from book
Figure 9.7: Sample CL code for system command changes.

The xxx represents the name of the command you have changed. When you upgrade your system to a new release, or apply PTFs that might change the definition of the original QSYS commands, you should compile this CL program and execute it.

First, it deletes the command in ALTQSYS and creates a new one from QSYS. The copy of the command in ALTQSYS command always reflects the latest changes made by IBM (such as added parameters). Finally, it changes the default value in the ALTQSYS copy.



IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
IBM i5/iSeries Primer(c) Concepts and Techniques for Programmers, Administrators, and Sys[... ]ators
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 245

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net