CL Command Reference - CHGPGM

CL Command List > CHGPGM Reference

Description:

The Change Program (CHGPGM) command changes the attributes of a program without requiring that it be recompiled. The user can also force re-creation of a program even if the attributes being specified are the same as the current attributes.

Note: When the CHGPGM command is run on OPM programs which have a DMT (Dictionary Mapping Table), were created in V3R6M0, and have all observability removed, the DMT will be removed from the program object, and a message will be issued indicating a successful change.

Restrictions:

. You must have object management (*OBJMGT) and use (*USE) authorities for the program that is to be changed.

. You must have at least *USE authority for the library where the program to be changed is located. You must also have delete (*DLT) and add (*ADD) authorities for the library in order to change the optimization attribute (OPTIMIZE parameter), performance collection attribute (ENBPFRCOL parameter), profiling data attribute (PRFDTA parameter), Licensed Internal Code options (LICOPT parameter), enable teraspace storage (TERASPACE parameter), or to force program re-creation by specifying FRCCRT(*YES).

. To change the user profile attribute (USRPRF parameter) or the use adopted authority attribute (USEADPAUT parameter), you must be the owner of the program, or be a member of the group profile that owns the program, or if your user profile (or one of your group profiles) has all object (*ALLOBJ) and security administrator (*SECADM) special authorities.

. Programs in the QSYS and QGDDM libraries cannot be changed, unless you are only removing observable information (RMVOBS parameter).

. The storage model (STGMDL) attribute of the program and all bound modules must be *SNGLVL to change a program to TERASPACE(*NO).

. Other jobs running the program may fail if the Optimize program (OPTIMIZE) parameter, Use adopted authority (USEADPAUT) parameter, Enable performance collection (ENBPFRCOL) parameter, Profiling data (PRFDTA) parameter, User profile (USRPRF) parameter, Licensed Internal Code options (LICOPT) parameter, or Teraspace (TERASPACE) parameter is changed, or program re-creation is forced by specifying FRCCRT(*YES).


Examples:

Example 1: Optimizing a Program

CHGPGM PGM(PROG1/SERVICE) OPTIMIZE(*YES) USRPRF(*OWNER)

The program SERVICE in library PROG1 is optimized, and the user profile under which it is processed is changed to include the program owner¡¯s user profile. Only the owner of program PROG1/SERVICE, or a user with security officer authority, can change the USRPRF attribute. The program is re-created only if the attributes specified differ from those of the current program.



Example 2: Changing Text for a Program

CHGPGM PGM(*USRLIBL/KNUTE) TEXT(¡¯Program description¡¯)

This command changes the text for program KNUTE. The user portion of the library list is used to find the program.



Example 3: Optimizing Multiple Programs

CHGPGM PGM(PROG1/ACE*) OPTIMIZE(*YES)

All programs in library PROG1 whose names begin with ACE, are optimized to their maximum optimization level.



Example 4: Changing Text of Multiple Programs

CHGPGM PGM(PROG2/*ALL) TEXT(¡¯Generic Text¡¯)

This command changes the text of all programs in library PROG2 to ¡¯Generic Text¡¯.



Example 5: Enabling Collection of Profiling Data

CHGPGM PGM(PROG1/PROFPGM) PRFDTA(*COL)

This command enables the collection of profiling data for program PROFPGM in library PROG1. If PROFPGM in library PROG1 had profiling data applied prior to issuing this command, all applied profiling data will be removed.



Example 6: Applying Profiling Data

CHGPGM PGM(PROG1/PROFPGM) PRFDTA(*APYALL)

This command applies block order and procedure order profiling data to program PROFPGM in library PROG1. The collection of profiling data is no longer enabled for program PROFPGM in library PROG1.