CHGCMDDFT (Change Command Default)
CHGCMDDFT Command syntax diagram
Purpose
The Change Command Default (CHGCMDDFT) command changes the default value of a command parameter. The parameter must have an existing default to change to a new default value. The changed command can be either an IBM-supplied command or a user-defined command.
To find out which parameters of a command have default values, enter the command name and press the F4 key (Prompt) to prompt for the command. Default values for parameters are shown on the first command prompt screen. However, not all defaults are shown. A parameter that is a list of elements or a qualified name may have a single value (SNGVAL) as the default of the entire list or qualified name. For example, Display Job (DSPJOB) is a command in which JOB is a list of elements but has a SNGVAL as the default for the entire list. See 'Additional Considerations' for more information on SNGVAL as a default value.
The new parameter default must be valid for the parameter being changed. To find out which values are valid, move the cursor to the default value shown and press the F4 key. The Parameter Prompt with Permissible Values display shows a list of valid values and/or the value of the parameter type. When only a list of valid values is shown, only those values can be used as new default values. Otherwise, any valid value that conforms to the requirements of the parameter can be used as the new default.
Processing a command that had earlier default value changes is the same as specifying the new default value for the parameter on an unchanged copy of the same command. The new default value may conflict with other parameter combinations even when the parameter is not explicitly specified.
When the user runs system commands with default value changes from system displays, the new default values cannot be used. This occurs because the system cannot use the command device to process a function. Instead, the system can use an IBM internal device to a system program to run the requested function. Therefore, use the F4 key (Prompt) key to prompt for the system command when processing the command from a system display. In most cases, the specified default value is then used.
To change an IBM-supplied command, the user should create a copy of the command in a user library and change the defaults of the copied command, instead of the IBM-supplied command itself. The user library should be listed before the library QSYS on the library list. Save the source of the CHGCMDDFT command so that the changes can be identified later. This procedure allows the user to use the original IBM-supplied command defaults when necessary and ensures that changes made to the copied commands are not overlaid when a new release on the system is installed.
A compatibility problem can occur when a new release of the system is installed. If IBM-supplied commands have been copied into a user library and the newly installed IBM-supplied version of the command has had new parameters added to it, the copied version of the command does not run correctly. This is a result of parameter mismatches between the copied command and the newly installed IBM-supplied command processing program. Also, if a copied command is used in the starting program of a user profile, this program does not run correctly, again because of parameter mismatches between the old command and the new command processing program. As a result, the user cannot sign onto the system. To prevent this, the user should ensure that at least one user profile exists on the system which has authority to make the required changes to the starting programs and has QCMD as the starting program. An alternative is to code the starting programs to detect all errors and to recover by showing the Command Entry display (program QCMD).
The CL Programming
book contains a list of recommendations and examples for using the Change Command Default (CHGCMDDFT) command.
Restriction: The user must have object management and *USE authority for the command being changed.
Required Parameters
- CMD
- Specifies the qualified name of the command being changed. The command can be a user-defined command or an IBM-supplied command.
The name of the command can be qualified by one of the following library values:
*LIBL: All libraries in the job's library list are searched until the first match is found.
*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be searched.
command-name: Specify the name of the command being changed.
- NEWDFT
- Specifies the parameter string, enclosed in apostrophes, that contains the new default values being assigned to a parameter, element, or qualifier if a value is not specified by the user when the command is processed.
New default values may be specified only for those parameters, elements, or qualifiers that already have a default value.
*N must be used as a place holder in a qualified name or in a list of values to take the place of elements or qualifiers that do not have existing default values. If the elements or qualifiers have default values but are not to be changed to a new default value, then *N or the existing default value can be used as the place holder in the list of values or the qualified name.
CHGCMDDFT CMD (USRQSYS/CRTCLPGM) NEWDFT('PGM(USERLIB1/*N)') or CHGCMDDFT CMD (USRQSYS/DSPFD) NEWDFT('OUTMBR(*N *ADD)')The new default value for each changed parameter, element, or qualifier must satisfy one of the following:
- It must match the requirements specified by TYPE, LEN, REL, RANGE, RSTD, and FULL attributes of the changed parameter, element, or qualifier.
- It must be a valid SPCVAL, SNGVAL, or VALUES value of the changed parameter, element, or qualifier.
A description of the TYPE, LEN, REL, RANGE, RSTD, FULL, SPCVAL, SNGVAL, or VALUES parameters is in command definition statements, (PARM, ELEM, or QUAL).
Note: Checking between parameters and Validity Checking Program processing is done when the command is run. Neither are performed during the changing of the default value. However, if dependencies between parameters exist for the keyword being changed, an informational message is sent indicating that checking was not done for the keyword. The command should be run immediately after making the change in default value to determine whether any additional rules were violated. To return to the IBM-supplied default, specify the desired default on the CHGCMDDFT command.
Examples for CHGCMDDFT
The following examples show changes in the defaults of command parameters when the CHGCMDDFT command is processed.
Example 1: Changing Default Value of AUT Parameter
CHGCMDDFT CMD(CRTPF) NEWDFT('AUT(*EXCLUDE)')This command changes the AUT default from *CHANGE to *EXCLUDE on the Create Physical File (CRTPF) command.
Example 2: Changing CRTCLPGM Command Defaults
CHGCMDDFT CMD(USRQSYS/CRTCLPGM) NEWDFT('PGM(LIB001/*N) SRCFILE(LIB001/FILE001) LOG(*YES)')This command changes the defaults of the Create CL Program (CRTCLPGM) command when the NEWDFT parameter is specified in the form above. In the example, the default value of the LOG parameter is *YES. No default can be specified for the second qualifier (program-name) of the PGM parameter because no default value exists. Therefore, *N is used as the place holder for the second qualifier. The first qualifier (library-name) of the PGM parameter has a default value of LIB001. For the SRCFILE parameter, the first qualifier (library-name) has a default value of LIB001. The second qualifier (source-file-name) has a default value of FILE001.
Example 3: Changing Default Value of MAXMBRS Parameter
CRTPF FILE(FILE1) RCDLEN(96) MAXMBRS(1) . . . CHGCMDDFT CMD(CRTPF) NEWDFT('MAXMBRS(*NOMAX)')This command changes the default value of the MAXMBRS keyword on the CRTPF command to *NOMAX.
Additional Considerations
A keyword that is defined as a list of elements or as a qualified name, and has a SNGVAL as the default, can have a required element or qualifier as the first element in the list of elements or qualified name. The default SNGVAL may be changed to another valid SNGVAL if one exists, but the required element or qualifier cannot have a default value. A SNGVAL cannot be used as a new default value if the existing default value is not a SNGVAL. To find out if list elements or qualifiers of a qualified name have default values, change the SNGVAL to a valid value for the keyword, blank out remaining list elements or qualifiers, and press the Enter key. If any remaining list elements or qualifiers have default values, the default values now appear in the input field for the list element or qualifier.
Error messages for CHGCMDDFT
*ESCAPE Messages
- CPF6260
- Errors detected while changing defaults.
- CPF6261
- Cannot change command &1 in library &2.