CRTPGM Command Reference

CRTPGM (Create Program) binds modules and service programs into a program object, *PGM. Use it when a program is made of more than one module, or when the modules were compiled separately with CRTRPGMOD. This page is the lookup for its parameters and defaults and for the error you meet when a bound service program changes.

For a walk-through of a whole build, read IBM i ILE Binding, Activation Groups, and Service Programs in 2026. For the module types, see the RPGLE Modules and NOMAIN Reference.

At a glance

QuestionAnswer
What does it create?A *PGM bound from existing modules and service programs
What does it need?At least one module, and a module that has a program entry procedure
What does it not do?Compile source. Compile first with CRTRPGMOD
One source member, no separate modules?Use CRTBNDRPG
Service program instead of program?Use CRTSRVPGM

Parameters that matter

Defaults are those on the IBM i 7.5 command page.

ParameterDefaultWhat it decides
PGMrequiredThe program name and library
MODULE*PGMThe modules copied and bound together, up to 300. *PGM means one module with the same name as the program. *ALL and generic names are allowed
ENTMOD*FIRSTThe module that holds the program entry procedure. *FIRST takes the first module in the MODULE list that has one. *ONLY requires that only one module has one. A module name selects it, and is added to the list if it is missing
BNDSRVPGM*NONEService programs whose exports are examined to resolve imports, each with *IMMED or *DEFER activation
BNDDIR*NONEBinding directories searched to resolve imports
ACTGRP*ENTMODThe activation group. *ENTMOD examines the entry module. *NEW creates a new group when the program is called. *CALLER activates the program in the caller’s group. A name selects a named group
OPTIONnone setBinder options such as *DUPPROC and *NODUPPROC, *WARN and *NOWARN, *RSLVREF and *UNRSLVREF, *GEN and *NOGEN
DETAIL*NONEThe binder listing: *BASIC, *EXTENDED or *FULL
ALWUPD*YESWhether the program may later be updated with the Update Program command, UPDPGM
ALWLIBUPD*NOWhether the library name of a bound service program may be changed when the program is updated with UPDPGM
USRPRF*USER*USER runs with the caller’s authority. *OWNER adds the owner’s authority
REPLACE*YESReplace an existing program of the same name
AUT*LIBCRTAUTPublic authority of the new program
TEXT*ENTMODTXTThe description. The default copies the entry module’s text
TGTRLS*CURRENTThe release the program must run on
STGMDL*SNGLVLThe storage model
IPA*NOInterprocedural analysis

The three to set deliberately are ENTMOD, BNDSRVPGM and ACTGRP. Naming ACTGRP explicitly means the program does not depend on what the entry module says. See the RPGLE Activation Groups Reference.

Example

A program built from one module that calls a service program:

CRTPGM PGM(MYLIB/REFOLD) MODULE(MYLIB/REFOLD) BNDSRVPGM((MYLIB/REFSIG)) ACTGRP(REFDEMO) DETAIL(*EXTENDED)

REFOLD is a module made earlier with CRTRPGMOD, and REFSIG is a service program that exports REFDOUBLE. The command binds the module into a program, records which service program it calls and under which signature, and assigns the program to the activation group REFDEMO.

Result: a *PGM named REFOLD. CALL PGM(REFOLD) displays REFOLD refDouble(21) = 42. The service program is not copied into the program. The program holds a reference to it and its signature. See bind by copy and bind by reference.

The signature error

A program records the signature of each service program it was bound to. If the service program is later rebuilt so that the signature the program expects is no longer in it, the call fails at activation. On the test system, CALL PGM(REFOLD) then gave Program signature violation. followed by Error found on CALL command.

The cause and the fix are in the RPGLE Binder Language and Signatures Reference. In short, keep the old signature in the service program with a PGMLVL(*PRV) block, or run CRTPGM again so the program picks up the new signature.

Common mistakes

  • Binding only NOMAIN modules. A NOMAIN module has no program entry procedure, so there is nothing for ENTMOD to select. Add a module that has one, or create a service program instead.
  • Leaving out the service program. Imports that no module, service program or binding directory supplies stay unresolved. Name the service program in BNDSRVPGM or list it in a binding directory. See the RPGLE Binding Directories Reference.
  • Expecting a rebuilt service program to reach an old program. The program holds a signature. A new signature without the old one breaks the call.
  • Relying on ACTGRP(*ENTMOD). Name the group.
  • Using ACTGRP(*NEW) for a program that others call often. IBM says a new activation group is created when the program is called.
  • Treating CRTPGM as a compiler. It binds. Compile errors belong to CRTRPGMOD.

Related commands

CommandRelation
CRTRPGMODCreates the modules that CRTPGM binds
CRTBNDRPGCompiles and binds one source member in one step
CRTSRVPGMBinds modules into a service program instead
DSPPGM with DETAIL(*SRVPGM)Lists the service programs a program is bound to

FAQ

What does CRTPGM do?

It binds existing modules, and references to service programs, into a program object that you can call.

What is ENTMOD?

The module that holds the program entry procedure. The default *FIRST takes the first module in the list that has one.

What is the difference between CRTPGM and CRTSRVPGM?

CRTPGM creates a program with an entry point. CRTSRVPGM creates a service program, which has no entry point of its own and is called through its exported procedures.

Do I have to name every service program?

Not if a binding directory lists them. Name them in BNDSRVPGM or put the directory in BNDDIR.

Summary

  • CRTPGM binds modules and service program references into a *PGM.
  • ENTMOD defaults to *FIRST and ACTGRP to *ENTMOD. Name the activation group explicitly.
  • A program holds the signature of each service program it uses, and a rebuild that drops that signature gives a signature violation.
  • Compile with CRTRPGMOD first, or use CRTBNDRPG for one source member.

Sources: IBM i 7.5 CRTPGM command (parameters, defaults, ENTMOD, ACTGRP) and IBM i 7.5 ILE Concepts. On IBM i V7R5M0 (PUB400, 2026-10-07) the example bound and ran (steps S03 and C6), and the signature violation was observed (N1). The parameter table, the ENTMOD rules, and the statements about *NOMAIN modules and unresolved imports were checked against IBM documentation only and were not run.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top