Change Module (CHGMOD)

Where allowed to run: All environments (*ALL)
Threadsafe: No
Parameters
Examples
Error messages

The Change Module (CHGMOD) command changes the attributes of a module object without requiring the module to be recompiled.

Restrictions:

Top

Parameters

Keyword Description Choices Notes
MODULE Module Qualified object name Required, Key, Positional 1
Qualifier 1: Module Generic name, name, *ALL
Qualifier 2: Library Name, *USRLIBL, *LIBL
OPTIMIZE Optimize module *SAME, *FULL, *BASIC, *NONE, 40, 30, 20, 10 Optional
RMVOBS Remove observable info Single values: *SAME, *NONE, *ALL
Other values (up to 3 repetitions): *CRTDTA, *DBGDTA, *ILDTA
Optional
ENBPFRCOL Enable performance collection Single values: *SAME, *NONE, *PEP
Other values: Element list
Optional
Element 1: Collection level *FULL, *ENTRYEXIT
Element 2: Procedures *ALLPRC, *NONLEAF
PRFDTA Profiling data *SAME, *NOCOL, *COL Optional
FRCCRT Force module recreation *NO, *YES Optional
TEXT Text 'description' Character value, *SAME, *BLANK Optional
LICOPT Licensed Internal Code options Single values: *SAME, *NONE
Other values: Element list
Optional
Element 1: Options Character value
Element 2: Action *REPLACE, *ADD
Top

Module (MODULE)

Specifies the module for which attributes are to be changed.

This is a required parameter.

Qualifier 1: Module

*ALL
All modules in the specified library to which the user has some authority are selected to be changed.
generic-name
Specify the generic name of the modules to be changed. A generic name is a character string of one or more characters followed by an asterisk (*); for example, ABC*. The asterisk substitutes for any valid characters. A generic name specifies all objects with names that begin with the generic prefix, for which the user has authority. If an asterisk is not included with the generic (prefix) name, the system assumes it to be the complete object name. If the complete object name is specified, and multiple libraries are searched, multiple objects can be changed, only if *ALL or *ALLUSR library values can be specified for the name.
name
Specify the name of the module to be changed.

Qualifier 2: Library

*USRLIBL
Only the libraries in the user portion of the job's library list are searched.
*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
name
Specify the name of the library where the module is located.
Top

Optimize module (OPTIMIZE)

Specifies the optimization level for the generated code in the module. Changing the optimization level of the module causes the system to re-create the module with the new optimization level.

*SAME
The module optimization level attribute is not changed.
*NONE or 10
No additional optimization will be performed on the generated code. Variables can be displayed and modified while debugging.
*BASIC or 20
Some optimization is performed on the code. Variables can be displayed but not modified while debugging.
*FULL or 30
More optimization is performed on the generated code, in addition to the amount performed at optimization level 20. Variables can be displayed but not modified while debugging.

Note: The value of the variable displayed during debugging may not be the current value of the variable.

40
This level includes all the optimization performed at optimization level 30. In addition, it includes optimization that disables call and instruction tracing. Tracing of modules with optimization level 40 cannot be done.
Top

Remove observable info (RMVOBS)

Specifies whether the observable information associated with modules is to be removed.

*SAME
The value does not change.
*ALL
Remove the debug data (*DBGDTA), the information necessary to re-create the module (*CRTDTA) using CHGMOD, and the intermediate language data (*ILDTA).

Note: *ALL cannot be specified if the module is enabled to collect profiling data.

*DBGDTA
The information necessary to allow module debugging is to be removed. The module cannot be debugged when it is included in a program or service program object.
*CRTDTA
The information necessary to allow module re-creation using CHGMOD, to change the optimization level, to change the performance collection attribute, or to change the profiling data attribute, is removed. NOTES:
  • *CRTDTA cannot be specified if the module is enabled to collect profiling data.
  • Creation data (either observable or unobservable) is required to convert modules to a different hardware technology, for example, between CISC (Complex Instruction Set Computer) and RISC (Reduced Instructions Set Computer) technology.
  • Modules created for release V5R1M0 or later (TGTRLS parameter when the module was created) will contain unobservable creation data even when *ALL or *CRTDTA observability is removed.
*ILDTA
The intermediate language data is removed.
*NONE
Observable information associated with the module is not removed.
Top

Enable performance collection (ENBPFRCOL)

Specifies whether collection of performance data is enabled.

Single values

*SAME
The current value of this parameter does not change.
*PEP or *NONE
Performance data is to be collected for the Program Entry Procedure entry and exit. There are no entry or exit hooks in the module's internal procedures and no precall or postcall hooks around calls to other procedures.

Element 1: Collection level

*FULL
Performance data is to be collected for procedure entry and exit. Performance data is also collected before and after calls to external procedures.
*ENTRYEXIT
Performance data is to be collected for procedure entry and exit.

Element 2: Procedures

*ALLPRC
Performance data is to be collected for all procedures. This is useful to capture information on all procedures.
*NONLEAF
Performance data is collected for procedures that are not leaf procedures and for the PEP. This is useful to capture information on most routines but not at the expense of destroying the 'leaf-ness' of the leaf procedure.
Top

Profiling data (PRFDTA)

Specifies the program profiling data attribute for the module. Program profiling is an advanced optimization technique to reorder procedures and code within the procedures based on statistical data (profiling data).

*SAME
The value does not change.
*NOCOL
This module is not enabled to collect profiling data.
*COL
This module is enabled to collect profiling data.

Note: *COL can be specified only when the optimization level of the module is *FULL (30) or greater.

Top

Force module recreation (FRCCRT)

Specifies whether module re-creation is forced.

*NO
Module re-creation is not forced unless the optimization level (OPTIMIZE), enable performance collection (ENBPFRCOL), or profiling data (PRFDTA) parameters are changed. This allows the system to determine whether a change is required.
*YES
Module re-creation is forced. If observable creation data has been removed, then re-creation (forced or not) is not allowed.
Top

Text 'description' (TEXT)

Specifies text that briefly describes the module and its function.

*SAME
The text description for the module is not changed.
*BLANK
Text is not specified.
'description'
Specify no more than 50 characters of text, enclosed in apostrophes.
Top

Licensed Internal Code options (LICOPT)

Specifies individual Licensed Internal Code compile-time options to be selected, and is intended for the advanced programmer who understands the potential benefits and drawbacks of each selected compiler option. Changing the Licensed Internal Code options of an Integrated Language Environment (ILE) module to any value other than *SAME causes the system to re-create the ILE module. Note: Additional information about the LICOPT options can be found in the ILE Concepts book, SC41-5606.

Element 1: Options

*SAME
If the module object is re-created, the existing Licensed Internal Code compile-time options are input to object re-creation. Otherwise, the Licensed Internal Code compile-time options do not change.
*NONE
Module re-creation is forced and no Licensed Internal Code options are used.
character-value
Specify one or more Licensed Internal Code compile-time options. Changing the Licensed Internal Code options of an Integrated Language Environment (ILE) module causes the system to re-create the ILE module.

Element 2: Action

*REPLACE
Any existing Licensed Internal Code options for the module are replaced with the specified values.
*ADD
The specified Licensed Internal Code options are added to the end of the existing Licensed Internal Code options string for the module. Any conflicts between Licensed Internal Code option values will be resolved with the last specified value taking precedence.
Top

Examples

Example 1: Optimizing for Maximum Performance

CHGMOD   MODULE(XYZ/PERFMOD)  OPTIMIZE(40)

This command optimizes module PERFMOD in library XYZ to ensure optimum performance.

Example 2: Removing All Observability

CHGMOD   MODULE(XYZ/NOOBSERV)  RMVOBS(*ALL)

This command removes all observability from module NOOBSERV in library XYZ. It can not be re-created, and can not be debugged when it is included in a program or service program object.

Example 3: Enabling Collection of Profiling Data

CHGMOD   MODULE(XYZ/PROFMOD)  OPTIMIZE(30)  PRFDTA(*COL)

This command enables module PROFMOD in library XYZ to collect profiling data when it is included in a program or service program object. The optimization level must be 30 or greater to enable a module to collect profiling data.

Top

Error messages

*ESCAPE Messages

CPF5CFA
Modules in library QSYS cannot be changed.
CPF5CFB
No modules changed.
CPF5CFC
&1 changed. &2 did not require change. &3 not changed.
CPF5CFE
Module &1 in library &2 not changed.
CPF5CFF
Module &1 in library &2 not changed.
CPF5CF7
*USRLIBL or *LIBL not allowed with a generic module name or *ALL.
CPF5CF8
Module &1 in library &2 not changed.
CPF5CF9
Module &1 in library &2 not changed.
CPF9801
Object &2 in library &3 not found.
CPF9803
Cannot allocate object &2 in library &3.
CPF9804
Object &2 in library &3 damaged.
CPF9806
Cannot perform function for object &2 in library &3.
CPF9810
Library &1 not found.
CPF9818
Object &2 in library &3 not created.
CPF9819
Object &2 in library &3 not created.
CPF9820
Not authorized to use library &1.
CPF9828
Not authorized to module &1 in library &2.
CPF9830
Cannot assign library &1.
CPF9899
Error occurred during processing of command.
Top