Create Program (CRTPGM)

The Create Program (CRTPGM) command creates a bound program from a set of modules and binding directories.

Restrictions:

Parameters

Keyword Description Choices Notes
PGM Program Qualified object name Required, Positional 1
Qualifier 1: Program Name
Qualifier 2: Library Name, *CURLIB
MODULE Module Single values: *PGM
Other values (up to 300 repetitions): Qualified object name
Optional
Qualifier 1: Module Generic name, name, *ALL
Qualifier 2: Library Name, *LIBL, *CURLIB, *USRLIBL
TEXT Text 'description' Character value, *ENTMODTXT, *BLANK Optional
ENTMOD Program entry procedure module Single values: *FIRST, *ONLY, *PGM
Other values: Qualified object name
Optional
Qualifier 1: Program entry procedure module Name
Qualifier 2: Library Name, *LIBL, *CURLIB, *USRLIBL
BNDSRVPGM Bind service program Single values: *NONE
Other values (up to 300 repetitions): Element list
Optional
Element 1: Service program Qualified object name
Qualifier 1: Service program Generic name, name, *ALL
Qualifier 2: Library Name, *LIBL
Element 2: Activation *IMMED, *DEFER
BNDDIR Binding directory Single values: *NONE
Other values (up to 300 repetitions): Qualified object name
Optional
Qualifier 1: Binding directory Name
Qualifier 2: Library Name, *LIBL, *CURLIB, *USRLIBL
ACTGRP Activation group Name, *ENTMOD, *NEW, *CALLER Optional
OPTION Creation options Values (up to 5 repetitions): *GEN, *NOGEN, *NODUPPROC, *DUPPROC, *NODUPVAR, *DUPVAR, *WARN, *NOWARN, *RSLVREF, *UNRSLVREF Optional
DETAIL Listing detail *NONE, *BASIC, *EXTENDED, *FULL Optional
ALWUPD Allow update *YES, *NO Optional
ALWLIBUPD Allow *SRVPGM library update *YES, *NO Optional
USRPRF User profile *USER, *OWNER Optional
REPLACE Replace program *YES, *NO Optional
AUT Authority Name, *LIBCRTAUT, *CHANGE, *ALL, *USE, *EXCLUDE Optional
TGTRLS Target release Character value, *CURRENT, *PRV Optional
ALWRINZ Allow reinitialization *NO, *YES Optional
STGMDL Storage model *SNGLVL, *TERASPACE, *INHERIT Optional
ARGOPT Argument optimization *NO, *YES Optional
IPA Interprocedural analysis *YES, *NO Optional
IPACTLFILE IPA control file Path name, *NONE Optional

Program (PGM)

Specifies the program object to be created.

This is a required parameter.

Qualifier 1: Program

name
Specify the name of the program to be created.

Qualifier 2: Library

*CURLIB
The program object is created in the current library for the job. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library where the program object is created.

Module (MODULE)

Specifies the list of modules that are copied and bound together to create the program object. If duplicate module and library specifications are found, only the first instance of the duplicate module and library is used. Modules in this list are copied into the final program object. Up to 300 names can be specified.

Single values

*PGM
The name specified for the Program (PGM) parameter is used as the module object name.

Qualifier 1: Module

*ALL
Find all module objects in the specified library or libraries.
generic-name
Specify all module objects starting with the characters preceding the * in the specified library or libraries.
name
Specify the name of the module that is copied to create the program object.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread 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.
*USRLIBL
Only the libraries in the user portion of the job's library list are searched.
name
Specify the name of the library to be searched.

Text 'description' (TEXT)

Specifies text that briefly describes the program object.

*ENTMODTXT
The text description of the module specified for the Program entry procedure module (ENTMOD) parameter is used.
*BLANK
Text is not specified.
character-value
Specify no more than 50 characters of text, enclosed in apostrophes.

Program entry procedure module (ENTMOD)

Specifies the module name that contains the program entry procedure specification to be used for this program.

Single values

*FIRST
The first module found, from the list of modules, that has a program entry procedure specification is selected as the program entry procedure.
*ONLY
Only one module, from the list of modules, can have a specification as the program entry procedure. An error is issued if more than one module is found to have a program entry procedure specification.
*PGM
The name and library specified on the Program (PGM) parameter will be the name and library of the module which has the program entry procedure specification.

Qualifier 1: Program entry procedure module

name
Specify the name of the module containing the program entry procedure specification. If this module is not in the list of modules to be included in this program, it is added to the list of modules. If this module does not have a program entry procedure specification, the program is not created.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread 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.
*USRLIBL
Only the libraries in the user portion of the job's library list are searched.
name
Specify the name of the library to be searched.

Bind service program (BNDSRVPGM)

Specifies the list of service program exports to examine at bind time to ensure they satisfy any module import requests. The service program exports are checked only if there are unresolved module import requests not satisfied by the set of module exports. Any service program specified on the BNDSRVPGM parameter that satisfies a module import request will be bound to the program being created. The service program name and the library specified on the BNDSRVPGM parameter are saved to be used at run time. Up to 300 names can be specified.

You can control the activation of each service program. You can specify whether the referenced service program is activated at the same time as the program program being created, or is deferred until a procedure exported from the referenced service program is called. Deferring activation may improve your application's performance.

Single values

*NONE
No service program is specified.

Element 1: Service program

Qualifier 1: Service program

*ALL
Find all service program objects in the specified library or libraries.

Note: This value should only be specified in a user-controlled environment when you know exactly what is getting bound to your program. Specifying *LIBL with *ALL may give you unpredictable results at program run time. Specify the generic service program name or specific libraries to better control what gets bound to your program.

generic-name
Specify all service program objects starting with the characters preceding the * in the specified library or libraries.
name
Specify the name of the service program to be examined during symbol resolution.

Qualifier 2: Library

*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 to be searched.

Note: QTEMP is not a valid library name for this parameter.

Element 2: Activation

*IMMED
Activation of the bound service program takes place immediately when the program being created is activated.
*DEFER
Activation of the bound service program may be deferred until a function it exports is called.

Binding directory (BNDDIR)

Specifies the list of binding directories that are used in symbol resolution. The exports of the modules and service programs in the binding directory are only checked if there are unresolved module import requests that the exports from the modules and service programs (specified in the MODULE or BNDSRVPGM parameters) could not satisfy. Up to 300 names can be specified.

Single values

*NONE
No binding directory is specified.

Qualifier 1: Binding directory

name
Specify the name of the binding directory used in symbol resolution.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread 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.
*USRLIBL
Only the libraries in the user portion of the job's library list are searched.
name
Specify the name of the library to be searched.

Activation group (ACTGRP)

Specifies the activation group this program is associated with when it is called. An activation group provides:

*ENTMOD
When ACTGRP(*ENTMOD) is specified, the program entry procedure module (ENTMOD parameter) is examined. If the module attribute is RPGLE, CBLLE, or CLLE, then ACTGRP(QILE) or ACTGRP(QILETS) is used. QILE is used when STGMDL(*SNGLVL) is specified, and QILETS is used when STGMDL(*TERASPACE) is specified. If the module attribute is not RPGLE, CBLLE, or CLLE, then ACTGRP(*NEW) is used.
*NEW
When this program gets called, a new activation group is created. This called program is then associated with the newly created activation group.
*CALLER
When this program gets called, the program is activated into the caller's activation group.
name
Specify the name of the activation group to be used when this program is called.

Creation options (OPTION)

Specifies options to be used when the program object is created.

You can specify up to 5 values for this parameter.

Program Objects

*GEN
A program object is generated.
*NOGEN
A program object is not generated.

Duplicate Procedure Names

*NODUPPROC
During the symbol resolution phase of the binding process, each procedure name that is exported from the modules and service programs must be unique.
*DUPPROC
During the symbol resolution phase of the binding process, the procedure names that are exported from the modules and service programs do not have to be unique. Additional information may be found in the ILE Concepts book, SC41-5606.

Duplicate Variable Names

*NODUPVAR
During the symbol resolution phase of the binding process, each variable name that is exported from the modules and service programs must be unique.
*DUPVAR
During the symbol resolution phase of the binding process, the variable names that are exported from the modules and service programs do not have to be unique. Additional information may be found in the ILE Concepts book, SC41-5606.

Issuing Diagnostic Messages

*WARN
If duplicate variables or procedures are found, a diagnostic message is issued indicating what duplicates were found.
*NOWARN
If duplicate variables or procedures are found, diagnostic messages are not issued.

Resolving References (Imports)

*RSLVREF
All imports must be resolved to exports for the program to be created.
*UNRSLVREF
All imports do not need to resolve to exports for the program to be created. If the program tries to use one of these unresolved imports at run time, a MCH4439 run-time exception is issued.

Listing detail (DETAIL)

Specifies the level of detail to be printed.

*NONE
A listing is not generated.
*BASIC
Contains a listing of the options passed to CRTPGM, and processing statistics. This listing also contains the Brief Summary Table.
*EXTENDED
In addition to the information provided in the *BASIC listing, this listing contains the Extended Summary Table and the Binding Information Listing.
*FULL
This listing contains the *EXTENDED listing and the Cross-Reference Listing.

Note: If a printed listing is requested, the printer file *LIBL/QSYSPRT is used to generate the listing.

Allow update (ALWUPD)

Specifies whether to allow an update, using the Update Program (UPDPGM) command, of the program being created.

*YES
The program can be updated using the UPDPGM command.
*NO
The UPDPGM command cannot be used to update the program being created.

Allow *SRVPGM library update (ALWLIBUPD)

Specifies whether to allow the bound service program library name of the program being created to be changed when updated using the Update Program (UPDPGM) command.

*NO
The UPDPGM command is not allowed to update the bound service program library names of the program being created, even if *YES is specified for the Allow update (ALWUPD) parameter.
*YES
The UPDPGM command is allowed to update the bound service program library names of the program being created when ALWUPD(*YES) is specified.

User profile (USRPRF)

Specifies whether the authority checking done while this program is running includes only the user who is running the program (*USER) or both the user running the program and the program owner (*OWNER). The profiles of the program user or both the program user and the program owner are used to control which objects can be used by the program, including the authority the program has for each object.

*USER
The program runs under the user profile of the program's user.
*OWNER
The user profiles of both the program owner and the program user are used when the program is run.

Replace program (REPLACE)

Specifies whether the existing program is replaced if a program by the same name already exists in the specified library.

*YES
Replace the existing program by moving it to the QRPLOBJ library. Current activations of the program will continue running, using the version of the program in the QRPLOBJ library.

Note: Both programs must be owned by the same user for the replace to work.

*NO
No replacement occurs. An error message is issued if a program already exists with the name and library specified for the Program (PGM) parameter.

Authority (AUT)

Specifies the authority you are giving to users who do not have specific authority for the object, who are not on an authorization list, and whose group profile or supplemental group profiles do not have specific authority for the object.

*LIBCRTAUT
The system determines the authority for the object by using the value specified for the Create authority (CRTAUT) parameter on the Create Library command (CRTLIB) for the library containing the object to be created. If the value specified for the CRTAUT parameter is changed, the new value will not affect any existing objects.
*CHANGE
The user can perform all operations on the object except those limited to the owner or controlled by object existence (*OBJEXIST) and object management (*OBJMGT) authorities. The user can change and perform basic functions on the object. *CHANGE authority provides object operational (*OBJOPR) authority and all data authority. If the object is an authorization list, the user cannot add, change, or remove users.
*ALL
The user can perform all operations except those limited to the owner or controlled by authorization list management (*AUTLMGT) authority. The user can control the object's existence, specify the security for the object, change the object, and perform basic functions on the object. The user also can change ownership of the object.
*USE
The user can perform basic operations on the object, such as running a program or reading a file. The user cannot change the object. Use (*USE) authority provides object operational (*OBJOPR), read (*READ), and execute (*EXECUTE) authorities.
*EXCLUDE
The user cannot access the object.
name
Specify the name of an authorization list to be used for authority to the object. Users included in the authorization list are granted authority to the object as specified in the list. The authorization list must exist when the object is created.

Target release (TGTRLS)

Specifies the release of the operating system on which you intend to use the object being created.

When specifying the target-release value, the format VxRxMx is used to specify the release, where Vx is the version, Rx is the release, and Mx is the modification level. For example, V5R3M0 is version 5, release 3, modification 0.

Valid values depend on the current version, release, and modification level of the operating system, and they change with each new release. You can press F4 while prompting this command parameter to see a list of valid target release values.

*CURRENT
The object is to be used on the release of the operating system currently running on your system. The object can also be used on a system with any subsequent release of the operating system installed.
*PRV
The object is to be used on the previous release with modification level 0 of the operating system. The object can also be used on a system with any subsequent release of the operating system installed.
character-value
Specify the release in the format VxRxMx. The object can be used on a system with the specified release or with any subsequent release of the operating system installed.

Allow reinitialization (ALWRINZ)

Specifies if the static storage of the program is allowed to be reinitialized while it is still active.

*NO
The static storage of the program can not be reinitialized while it is still active.
*YES
The static storage of the program is allowed to be reinitialized while the program is still active.

Storage model (STGMDL)

Specifies the storage model attribute of the program.

*SNGLVL
The program is created with single-level storage model. When a single-level storage model program is activated and run, it is supplied single-level storage for automatic and static storage. A single-level storage program runs only in a single-level storage activation group.
*TERASPACE
The program is created with teraspace storage model. When a teraspace storage model program is activated and run, it is supplied teraspace storage for automatic and static storage. A teraspace storage program runs only in a teraspace storage activation group.
*INHERIT
The program is created with inherit storage model. When activated, the program adopts the storage model of the activation group into which it is activated. An equivalent view is that it inherits the storage model of its caller. When the *INHERIT storage model is selected, *CALLER must be specified for the Activation group (ACTGRP) parameter.

Argument optimization (ARGOPT)

Specifies whether argument optimization (ARGOPT) is to be done during program creation. Argument optimization is a technique for passing arguments (parameters) to ILE procedures to improve performance of call intensive applications. This option may cause an increase in the amount of time required to create the program.

*NO
Argument optimization will not be performed during program creation.
*YES
Argument optimization will be performed during program creation.

Interprocedural analysis (IPA)

Specifies whether interprocedural analysis (IPA) is to be used during the program creation. For more information on IPA, refer to the ILE Concepts book, SC41-5606.

*NO
Interprocedural analysis will not be performed.
*YES
Interprocedural analysis will be performed.

IPA control file (IPACTLFILE)

Gives the path name of a file which contains interprocedural analysis (IPA) suboption information. This parameter is allowed only when IPA(*YES) is specified.

*NONE
No IPA control file information is to be used when IPA(*YES) is specified.
path-name
Specifies the path name of the IPA control file to use when IPA(*YES) is specified. If the name is qualified it must be enclosed in apostrophes. An example of a qualified IPA control file name is '/directory1/directory2/myipactlfname'

Examples

CRTPGM   PGM(STAR)

This command creates a program object named STAR in the current library for the job, or library QGPL if there is no current library. The program will be created from one module object that is also named STAR and is located using the current library for the job.

Error messages

*ESCAPE Messages

CPF223E
Authority check for use adopted authority attribute failed.
CPF3C50
Program &1 not created.
CPF5D12
Error encountered during program or service program preparation.