Change Service Program (CHGSRVPGM)
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, the teraspace attribute, the storage model, 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), storage model (STGMDL), enable teraspace storage (TERASPACE), or to force service program re-creation by specifying FRCCRT(*YES).
- To change the user profile attribute (USRPRF parameter) or the use adopted authority attribute (USEADPAUT parameter), you or one of your group profiles must either be the owner of the service program or have all object (*ALLOBJ) and security administrator (*SECADM) special authorities.
- Service programs in library QSYS, QGDDM, and QTEMP cannot be changed unless the only indicated change is a removal of observable information.
| Keyword |
Description |
Choices |
Notes |
| SRVPGM |
Service program |
Qualified object name |
Required, Key, Positional 1 |
| Qualifier 1: Service program |
Generic name, name, *ALL |
| Qualifier 2: Library |
Name, *USRLIBL |
| OPTIMIZE |
Optimize service program |
*SAME, *FULL, *BASIC, *NONE, 40, 30, 20, 10 |
Optional |
| USRPRF |
User profile |
*SAME, *USER, *OWNER |
Optional |
| USEADPAUT |
Use adopted authority |
*SAME, *YES, *NO |
Optional |
| RMVOBS |
Remove observable info |
Single values: *SAME, *ALL, *NONE Other values (up to 4 repetitions): *CRTDTA, *DBGDTA, *BLKORD, *PRCORD |
Optional |
| PRFDTA |
Profiling data |
*SAME, *NOCOL, *COL, *CLR, *APYBLKORD, *APYPRCORD, *APYALL |
Optional |
| FRCCRT |
Force recreation |
*NO, *YES, *NOCRT |
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 |
| NBRTHD |
Number of threads |
1-256, 1, *CALC |
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 |
| TERASPACE |
Teraspace |
*SAME, *YES, *NO |
Optional |
| STGMDL |
Storage model |
*SAME, *INHERIT |
Optional |
Service program (SRVPGM)
Specifies the service programs whose attributes are being changed. *USRLIBL cannot be specified or defaulted for the library qualifier when a generic name or *ALL is specified for the program qualifier.
This is a required parameter.
Qualifier 1: Service program
-
- *ALL
- All service programs in the specified library to which the user has some authority (for example, *USE authority) are selected for change.
- generic-name
- Specify the generic name of the service program. 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 service programs whose attributes are being changed.
Qualifier 2: Library
-
- *USRLIBL
- Only the libraries in the user portion of the job's library list are searched.
- name
- Specify the name of the library where the program is located.
Optimize service program (OPTIMIZE)
Specifies whether the service program is optimized. This parameter removes redundant instructions from the specified programs. Changing the current optimization level of a service program causes the system to re-create the service program with the new optimization level.
-
- *SAME
- The value does not change.
- *NONE or 10
- The service program is not optimized. Variables can be displayed and changed when debugging ILE service programs at this optimization level.
- *BASIC or 20
- Some optimization is performed on the code. When debugging ILE service programs at this level, variables may be displayed but not changed.
- *FULL or 30
- More optimization is performed in addition to the optimization performed at level 20. Variables cannot be changed but can be displayed while the program is being debugged. However, the displayed value of the variable during debugging may not be its actual value.
- 40
- This level includes all the optimization performed at optimization level 30. In addition, it includes optimization that disables call and instruction tracing. Thus, tracing of modules created at this optimization level cannot be performed.
User profile (USRPRF)
Specifies whether the authority checking done while this service program is running includes only the user who is running the service program (*USER) or both the user running the service program and the service program owner (*OWNER). The profiles of the service program user or both the service program user and the service program owner are used to control which objects can be used by the service program, including the authority the service program has for each object.
Note: To change the user profile attribute, you or one of your group profiles must either be the owner of the service program or have all object (*ALLOBJ) and security administrator (*SECADM) special authorities.
-
- *SAME
- The value does not change.
- *USER
- The service program runs under the user profile of the service program's user.
- *OWNER
- The user profiles of both the service program's owner and the service program's user are used when the service program is processed. The collective sets of object authority in both user profiles are used to find and access objects during service program processing. Authority from the owning user profile's group profile is not included in the authority for the running service program.
Use adopted authority (USEADPAUT)
Specifies whether service program adopted authority from previous programs or service programs in the call stack are used as a source of authority when this service program is running.
Note: To change the use adopted authority attribute, you or one of your group profiles must either be the owner of the service program or have all object (*ALLOBJ) and security administrator (*SECADM) special authorities.
-
- *SAME
- The value does not change.
- *YES
- Program or service program adopted authority from previous recursion levels is used when this service program is running.
- *NO
- Program or service program adopted authority from previous recursion levels is not used when this service program is running.
Remove observable info (RMVOBS)
Specifies whether the observable information associated with service programs is removed.
-
- *SAME
- The value does not change.
- *ALL
- All of the observable information associated with the service program is removed, if possible. If the service program requires the observable information to ensure that it runs correctly, that information is not removed.
NOTES:
- If block order profiling data has previously been applied to this ILE service program, specifying *ALL on the RMVOBS parameter also removes *BLKORD observability.
- *ALL cannot be specified if the ILE service program is enabled to collect profiling data.
Also see the notes for the *CRTDTA special value.
- *NONE
- None of the observable information associated with the service program is removed.
- *DBGDTA
- All of the observable information necessary to allow the service program to be debugged is removed.
- *CRTDTA
- All of the observable creation data is removed. Observable creation data is necessary to allow the service program to be re-created using CHGSRVPGM, or to change service program attributes using any of the command parameters OPTIMIZE, USRPRF, USEADPAUT, ENBPFRCOL, PRFDTA, LICOPT, TERASPACE, or STGMDL.
NOTES:
- *CRTDTA cannot be specified if the ILE service program is enabled to collect profiling data.
- Creation data (either observable or unobservable) is required to convert service programs to a different hardware technology, for example, between CISC (Complex Instruction Set Computer) and RISC (Reduced Instructions Set Computer) technology.
- Service programs created only from modules created for release V5R1M0 or later (TGTRLS parameter when the module was created) will retain unobservable creation data even when *ALL observability or *CRTDTA observability is removed.
- If the service program was created for a release earlier than V5R1M0, or if it contains bound modules created for a release earlier than V5R1M0, *ALL observability and *CRTDTA observability cannot be removed.
- Service programs containing bound CL modules created with ALWRTVSRC(*YES) can have their CL source retrieved using the RTVCLSRC (Retrieve CL Source) command even after *ALL observability or *CRTDTA observability has been removed.
- *BLKORD
- Block order profiling data is removed from the service program.
- *PRCORD
- Procedure order profiling data is removed from the service program.
Profiling data (PRFDTA)
Specifies the program profiling data attribute for service programs. 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
- The collection of profiling data is not enabled and profiling data is not applied.
- *COL
- The collection of profiling data is enabled for eligible modules.
Note: Specifying *COL removes all applied profiling data if the service program has profiling data applied.
- *CLR
- All previously collected profiling data is discarded. The service program remains enabled to collect profiling data.
- *APYBLKORD
- Block order profiling data is applied to every module bound into this service program previously enabled to collect profiling data. The collection of profiling data is no longer enabled.
- *APYPRCORD
- Block order and procedure order profiling data are applied. The collection of profiling data is no longer enabled.
- *APYALL
- Block order and procedure order profiling data are applied. The collection of profiling data is no longer enabled.
Force recreation (FRCCRT)
Specifies whether service program re-creation is forced.
-
- *NO
- Service program re-creation is not forced unless the Optimize service program (OPTIMIZE) parameter, the Use adopted authority (USEADPAUT) parameter, the Enable performance collection (ENBPFRCOL) parameter, the Profiling data (PRFDTA) parameter, the User profile (USRPRF) parameter, the Licensed Internal Code options (LICOPT) parameter, the Teraspace (TERASPACE) parameter, or the Storage model (STGMDL) parameter has changed. This option allows the system to determine whether a change is required.
- *YES
- Service program re-creation is forced.
- *NOCRT
- No service program re-creation is done. If you attempt to change a service program attribute which would implicitly require the service program to be re-created, an error message is issued and no attributes of the service program are changed. Modifying one of the following parameters may cause the service program to be re-created: OPTIMIZE, USEADPAUT, ENBPFRCOL, PRFDTA, USRPRF, LICOPT, TERASPACE, or STGMDL.
Text 'description' (TEXT)
Specifies text that briefly describes the service program.
-
- *SAME
- The value does not change.
- *BLANK
- Text is not specified.
- character-value
- Specify no more than 50 characters of text, enclosed in apostrophes.
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) service program to any value other than *SAME causes the system to re-create the ILE service program. Note: Additional information about the LICOPT options can be found in the ILE Concepts book, SC41-5606.
Element 1: Options
-
- *SAME
- If the service program 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
- Service program re-creation is forced and no Licensed Internal Code options are used for all the bound modules.
- character-value
- Specify one or more Licensed Internal Code compile-time options. Changing the Licensed Internal Code options of an Integrated Language Environment (ILE) service program causes the system to re-create the ILE service program.
Element 2: Action
-
- *REPLACE
- Any existing Licensed Internal Code options for the bound modules 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 each of the bound modules. Any conflicts between Licensed Internal Code option values will be resolved with the last specified value taking precedence.
Number of threads (NBRTHD)
Specifies the maximum number of threads to use when re-creating bound modules. Specifying a number greater than 1 allows the command to take advantage of available CPU cycles, especially on a multi-processor system.
-
- 1
- A single thread is used when creating bound modules.
- *CALC
- The system calculates a reasonable maximum number of threads to use which will not use excessive resources. Usually this is one or two threads for each available processor.
- 1-256
- Specify the maximum number of threads to use.
Enable performance collection (ENBPFRCOL)
This parameter is obsolete.
Teraspace (TERASPACE)
Specifies whether the service program object is enabled to work with teraspace storage. This includes teraspace storage allocated by the module object and parameters passed from other teraspace-enabled program and service program objects.
If the service program being changed was created for TGTRLS(V6R1M0) or a later release, the service program will be enabled for teraspace regardless of the value specified for this parameter. If the service program being changed was created for a release prior to V6R1M0, the TERASPACE value specified will be stored in the service program and will be used when the service program is brought to a release prior to V6R1M0. However, when the service program is on V6R1M0 and later releases, it is enabled for teraspace.
If the service program being changed has a target release (TGTRLS) value earlier than V6R1M0, specifying a value different than the current TERASPACE attribute value will cause the service program to be recreated and the specified value will be stored in the object template information.
-
- *SAME
- The teraspace storage enablement does not change.
- *NO
- If the service program was created for a release prior to V6R1M0, then the teraspace storage enablement of the eligible bound modules is changed to no. A bound module must be single level storage model to be changed to TERASPACE(*NO).
- *YES
- If the service program was created for a release prior to V6R1M0, then the teraspace storage enablement of the eligible bound modules is changed to yes. A bound module must be at least V4R4M0 or later to be changed to TERASPACE(*YES).
Storage model (STGMDL)
Specifies the storage model attribute of the service program.
-
- *SAME
- The storage model of the service program remains unchanged.
- *INHERIT
- The service program can use either single-level storage or teraspace storage. The type of storage used will depend on the type of storage required by the caller.
Restrictions:
- The activation group attribute of the service program must be *CALLER.
- The current storage model of the service program cannot be *TERASPACE.
- The target release of the service program must be V5R1M0 or later.
- The target release of all bound modules in the service program must be V5R1M0 or later.
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. 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.
*ESCAPE Messages
- CPF223C
- Not authorized to change the use adopted authority (USEADPAUT) attribute for &1 in &2 type *&3.
- CPF223E
- Authority check for use adopted authority attribute failed.
- CPF5CEB
- Service program &1 in library &2 not found.
- CPF5CEC
- &1 changed. &2 did not require change. &3 not changed.
- CPF5CED
- No service programs changed.
- CPF5CEE
- Service programs in libraries QSYS and QGDDM cannot be changed.
- CPF5CEF
- *USRLIBL not allowed with generic name or *ALL.
- CPF5CF0
- User &3 not authorized to change &1.
- CPF5CF1
- Cannot remove observable information.
- CPF5CF2
- User &3 not authorized to change &1.
- CPF5CF3
- Service program &1 in library &2 not changed.
- CPF5CF4
- Service program &1 in &2 not changed.
- CPF5D04
- Not authorized to service program &1 in library &2.
- CPF5D0A
- Cannot remove requested observability from object &1 type *&3.
- 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.
- CPF9830
- Cannot assign library &1.