CL Command Reference - CHGSRVPGM

CL Command List > CHGSRVPGM Reference

Description:

The Change Service Program (CHGSRVPGM) command changes the attributes of a program without requiring that it be recompiled. The attributes that can be changed are the optimization attribute, the user profile attribute, the use-adopted-authority attribute, the performance collection attribute, the profiling data attribute, and the service program text. The user can also force re-creation of a service program even if the attributes being specified are the same as the current attributes.

Restrictions:

. You must have use (*USE) authority to the library for the service program that is being changed.

. You must have *USE and object management (*OBJMGT) authorities for the service program that is being changed.

. You must have *USE, delete (*DLT), and add (*ADD) authority to the library to change the optimization attribute (OPTIMIZE), performance collection attribute (ENBPFRCOL), profiling data attribute (PRFDTA), Licensed Internal Code Options (LICOPT), enable teraspace storage (TERASPACE), or to force service program re-creation by specifying FRCCRT(*YES).

. Service programs in library QSYS, QGDDM, and QTEMP cannot be changed unless the only indicated change is a removal of observable information.

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


Examples:

Example 1: Optimizing a Service Program

CHGSRVPGM SRVPGM(PROG1/SERVICE) OPTIMIZE(*FULL)
USRPRF(*OWNER)

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



Example 2: Changing Text for a Service Program

CHGSRVPGM PGM(*USRLIBL/KNUTE)
TEXT(¡¯Service program description¡¯)

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



Example 3: Optimizing Multiple Service Programs

CHGSRVPGM SRVPGM(PROG1/ACE*) OPTIMIZE(40)

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



Example 4: Changing Text of Multiple Service Programs

CHGSRVPGM SRVPGM(PROG2/*ALL) TEXT(¡¯Generic Text¡¯)

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



Example 5: Enabling Collection of Profiling Data

CHGSRVPGM SRVPGM(PROG1/PROFPGM) PRFDTA(*COL)

This command enables the collection of profiling data for service 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

CHGSRVPGM SRVPGM(PROG1/PROFPGM) PRFDTA(*APYALL)

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