You can change the default value of a command keyword by using the Change Command Default (CHGCMDDFT) command. Refer to the CL section of the Programming category of the iSeries Information Center for details. The keyword must have an existing default in order to allow a change to a new default value. You can change either an IBM-supplied command or a user-written command. You must use caution when changing defaults for IBM-supplied commands. The following are recommendations for changing defaults:
Use the Change System Library List (CHGSYSLIBL) command to move the user library ahead of QSYS or any other system-supplied libraries in the library list. This will allow the user to use the changed command without using the library qualifier.
Changes to commands that are needed on a system-wide basis should be made in a user library. Additionally, you should add the user library name to the QSYSLIBL system value ahead of QSYS. The changed command is used system-wide. If you need to run an application that uses the IBM-supplied default, do so by using the Change System Library List (CHGSYSLIBL) command. Doing this removes the special library or library-qualify to the affected commands.
If an IBM-supplied command has new keywords, a copy of the command from a previous release may not run properly.
The following is an example of a CL program that is used to delete the old version and create the new changed command:
PGM DLTCMD USRQSYS/SIGNOFF CRTDUPOBJ OBJ(SIGNOFF) FROMLIB(QSYS) OBJTYPE(*CMD) + TOLIB(USRQSYS) NEWOBJ(*SAME) CHGCMDDFT CMD(USRQSYS/SIGNOFF) NEWDFT('LOG(*LIST)') . . Repeat the DLTCMD, CRTDUPOBJ and CHGCMDDFT for each command you want changed . . ENDPGM
You can track changes you make to CL command defaults for use when you install a new release. To track changes, register an exit program for exit point QIBM_QCA_RTV_COMMAND. The exit program is called when you run the CHGCMDDFT command. One of the parameters passed to the exit program is the command string that is being run. You can save the command string to a source file and then compile the source file into a CL program. Finally, you use this program to reproduce the changes you have made to command defaults during the previous release. For more information, see the Command Analyzer Retrieve exit program description in the APIs section of the Programming category of the iSeries Information Center.
The following steps can be used to build the NEWDFT command string for the CHGCMDDFT command. The USRQSYS/CRTCLPGM command is used in this example.
CRTDUPOBJ OBJ(CRTCLPGM) FROMLIB(QSYS) OBJTYPE(*CMD) + TOLIB(USRQSYS) NEWOBJ(*SAME)
USRQSYS/CRTCLPGM PGM(PGM1) AUT(*EXCLUDE) + TEXT('Isn''t this nice text')
USRQSYS/CRTCLPGM AUT(*EXCLUDE) + TEXT('Isn''t this nice text')
Remember that you may change only parameters, elements, or qualifiers that have existing default values. Specifying a value for a parameter, element, or qualifier that does not have an existing default value makes no default changes.
CHGCMDDFT USRQSYS/CRTCLPGM AUT(*EXCLUDE) + TEXT('Isn''t this nice text')
CHGCMDDFT USRQSYS/CRTCLPGM 'AUT(*EXCLUDE) + TEXT('Isn''t this nice text')'
CHGCMDDFT USRQSYS/CRTCLPGM 'AUT(*EXCLUDE) + TEXT(''Isn''''t this nice text'')'
Command . . . . . . . . . . : CMD R CRTCLPGM Library . . . . . . . . . : USRQSYS New default parameter string: NEWDFT R 'AUT(*EXCLUDE) TEXT(''Isn''''t this nice text'')'
CHGCMDDFT CMD(USRQSYS/CRTCLPGM) NEWDFT('AUT(*EXCLUDE) + TEXT(''Isn''''t this nice text'')')
To provide a default value of *NOMAX for the MAXMBRS keyword of command CRTPF, do the following:
CRTPF FILE(FILE1) RCDLEN(96) MAXMBRS(1) . . CHGCMDDFT CMD(CRTPF) NEWDFT('MAXMBRS(*NOMAX)')
To provide a default value of 10 for the MAXMBRS keyword of the command CRTPF, do the following:
CRTPF FILE(FILE1) RCDLEN(96) MAXMBRS(*NOMAX) . . CHGCMDDFT CMD(CRTPF) NEWDFT('MAXMBRS(10)')
The following allows you to provide a default value of LIB001 for the first qualifier of the SRCFILE keyword and FILE001 for the second qualifier of the SRCFILE keyword for the command CRTCLPGM. The AUT keyword now have a default value of *EXCLUDE.
CRTCLPGM PGM(PROGRAM1) SRCFILE(*LIBL/QCMDSRC) . . CHGCMDDFT CMD(CRTCLPGM) + NEWDFT('SRCFILE(LIB001/FILE001) AUT(*EXCLUDE)')
The following provides a default value of 'Isn't this print text' for the PRTTXT keyword of the command CHGJOB. Since the NEWDFT keyword has embedded apostrophes, you must not double these apostrophes, or the process will not run correctly.
CHGJOB PRTTXT('Isn''t this print text') . . CHGCMDDFT CMD(CHGJOB) + NEWDFT('PRTTXT(''Isn''''t this print text'')')
The following provides a default value of QGPL for the first qualifier (library name) of the first list item of the DTAMBRS keyword for the command CRTLF. The new default value for the second list item of the DTAMBRS keyword (member name) is MBR1.
CRTLF FILE(FILE1) DTAMBRS(*ALL) . . CHGCMDDFT CMD(CRTLF) + NEWDFT('DTAMBRS((QGPL/*N (MBR1)))')
Since *ALL is a SNGVAL (single value) for the entire DTAMBRS list, the defaults of *CURRENT for the library name and *NONE for the member name do not show up on the original command prompt display. The defaults *CURRENT and *NONE can be changed to a new default value but do not show up on the original prompt display because of the *ALL single value for the entire DTAMBRS list.
Create a command that will display the spool files for a job:
CRTDUPOBJ OBJ(WRKJOB) FROMLIB(QSYS) + TOLIB(MYLIB) NEWOBJ(WRKJOBSPLF) WRKJOBSPLF OPTION(*SPLF) . . CHGCMDDFT CMD(MYLIB/WRKJOBSPLF) + NEWDFT('OPTION(*SPLF)')
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.