CRTBNDRPG (Create Bound RPG Program) compiles one RPGLE source member and creates a program, *PGM, in a single step. It is the command most RPG programmers use first. This page is the lookup for its parameters and defaults, and for the two errors that appear when a program needs binding.
It is a reference, not a build walkthrough. For the compile flow in plain terms, read RPGLE Source Members, Compilers, and the Build Flow. For the activation group choice behind DFTACTGRP and ACTGRP, see the RPGLE Activation Groups Reference.
At a glance
| Question | Answer |
|---|---|
| What does it create? | A *PGM from one source member |
| What does it not give you? | A reusable *MODULE. Use CRTRPGMOD for that |
| Can it bind several modules? | No. It works on one source member. Use CRTPGM to bind several modules |
| Can it use service programs? | Yes, through a binding directory or the BNDDIR control keyword, and only with DFTACTGRP(*NO) |
| Which source cannot use it? | NOMAIN source. A NOMAIN module has no program entry procedure |
Parameters that matter
Defaults are those on the IBM i 7.5 command page.
| Parameter | Default | What it decides |
|---|---|---|
PGM | *CTLSPEC | The program name. *CTLSPEC takes it from the DFTNAME control specification keyword |
SRCFILE | QRPGLESRC | The source physical file |
SRCMBR | *PGM | The source member. *PGM means the member has the same name as the program |
SRCSTMF | none | A stream file as the source. See the note under common mistakes |
DFTACTGRP | *YES | *YES runs the program in the default activation group. IBM says ILE static binding is not available then, so you cannot use BNDDIR or ACTGRP |
ACTGRP | *STGMDL | Used only with DFTACTGRP(*NO). *STGMDL activates the program in QILE, or in QILETS when the storage model is teraspace. *NEW, *CALLER and a name are the other values |
BNDDIR | *NONE | Binding directories searched to resolve imports. Not allowed with DFTACTGRP(*YES) |
OPTION | none set | Compiler options in pairs such as *XREF and *NOXREF, *GEN and *NOGEN |
DBGVIEW | *STMT | The debug views. *SOURCE gives source-level debugging |
REPLACE | *YES | Replace an existing program of the same name |
TEXT | *SRCMBRTXT | The description. The default copies the source member’s text |
TGTRLS | *CURRENT | The release the program must run on |
USRPRF | *USER | *USER runs with the caller’s authority. *OWNER adds the owner’s authority |
AUT | *LIBCRTAUT | Public authority of the new program |
OUTPUT | *PRINT | *PRINT produces a compiler listing |
The pair to remember is DFTACTGRP and BNDDIR. The first has a default of *YES, and the second only works when the first is *NO.
Example
A caller that uses a service program through a binding directory states its binding choices in the control specification, and the command stays short:
CRTBNDRPG PGM(MYLIB/REFUCALL) SRCFILE(MYLIB/QRPGLESRC) SRCMBR(REFUCALL) DBGVIEW(*SOURCE)
The source of REFUCALL begins with ctl-opt dftactgrp(*no) actgrp('REFDEMO') bnddir('REFBND');. The full source is in the RPGLE Service Programs Reference, and the binding directory is described in the RPGLE Binding Directories Reference.
Result: a *PGM named REFUCALL. It calls two procedures from a service program found through REFBND, and CALL PGM(REFUCALL) displays Result: Number 42.
Two errors worth knowing
These are the diagnostics the compiler gave on the test system.
| You did | Compiler said | Why |
|---|---|---|
Ran CRTBNDRPG on a NOMAIN source | RNF1304 20: the NOMAIN keyword is not valid when CRTBNDRPG is used to create a program | A NOMAIN module has no program entry procedure. The listing also reported RNF1520, that the procedure cannot be defined with DFTACTGRP(*YES), the command’s default |
Named a binding directory with DFTACTGRP(*YES) | RNF9302: parameter BNDDIR not allowed with DFTACTGRP(*YES) | Static binding is not available in the default activation group |
The fix for the first is CRTRPGMOD followed by CRTPGM or CRTSRVPGM. The fix for the second is DFTACTGRP(*NO), normally with an explicit ACTGRP.
Common mistakes
- Leaving the
DFTACTGRP(*YES)default when the program calls bound procedures. Setdftactgrp(*no)in the control specification or on the command. - Compiling
NOMAINsource withCRTBNDRPG. See the table above. - Expecting
ACTGRPto apply withDFTACTGRP(*YES). IBM says you cannot use it then. - Using
*NEWfor every program. Each call then creates a new activation group. Pick a named group or*CALLERdeliberately. - Relying on
SRCSTMFwithout testing it. On the PUB400 system used to check this site (IBM i V7R5M0), compiles withSRCSTMF(...)failed withRNS9339: Unable to open file, while the same source copied into a source file member compiled. It is a documented parameter and may work on your system.
Related commands
| Command | Relation |
|---|---|
| CRTRPGMOD | Compiles to a module instead of a program |
| CRTPGM | Binds several modules and service programs into a program |
| CRTSRVPGM | Creates a service program from modules |
For the module types and which command each needs, see the RPGLE Modules and NOMAIN Reference. For the wider ILE picture, read IBM i ILE Binding, Activation Groups, and Service Programs in 2026.
FAQ
What does CRTBNDRPG create?
A program object, *PGM, from one RPGLE source member, compiled and bound in one step.
Why is DFTACTGRP(*YES) the default?
It is the default IBM ships for the command. With it the program always runs in the default activation group, and ILE static binding is not available, so programs that call bound procedures need DFTACTGRP(*NO).
Can CRTBNDRPG create a service program?
No. A service program is created with CRTSRVPGM from modules.
What is the difference between CRTBNDRPG and CRTPGM?
CRTBNDRPG compiles one source member into a program. CRTPGM binds modules that already exist.
Summary
CRTBNDRPGcompiles one source member into a*PGM.- The default
DFTACTGRP(*YES)rules outBNDDIR,ACTGRPand static binding. NOMAINsource needsCRTRPGMODand thenCRTPGMorCRTSRVPGM.- Use CRTPGM when a program is made of several modules.
Sources: IBM i 7.5 CRTBNDRPG command (parameters, defaults, DFTACTGRP and static binding) and the IBM i 7.5 ILE RPG Reference. On IBM i V7R5M0 (PUB400, 2026-10-07) the REFUCALL example compiled and ran (steps B09 and C3), and the two errors above were observed (B14 and B15). The parameter table, the *STGMDL meaning, and the USRPRF, AUT and TGTRLS rows were checked against IBM documentation only and were not run.