CRTBNDRPG Command Reference

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

QuestionAnswer
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.

ParameterDefaultWhat it decides
PGM*CTLSPECThe program name. *CTLSPEC takes it from the DFTNAME control specification keyword
SRCFILEQRPGLESRCThe source physical file
SRCMBR*PGMThe source member. *PGM means the member has the same name as the program
SRCSTMFnoneA 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*STGMDLUsed 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*NONEBinding directories searched to resolve imports. Not allowed with DFTACTGRP(*YES)
OPTIONnone setCompiler options in pairs such as *XREF and *NOXREF, *GEN and *NOGEN
DBGVIEW*STMTThe debug views. *SOURCE gives source-level debugging
REPLACE*YESReplace an existing program of the same name
TEXT*SRCMBRTXTThe description. The default copies the source member’s text
TGTRLS*CURRENTThe release the program must run on
USRPRF*USER*USER runs with the caller’s authority. *OWNER adds the owner’s authority
AUT*LIBCRTAUTPublic 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 didCompiler saidWhy
Ran CRTBNDRPG on a NOMAIN sourceRNF1304 20: the NOMAIN keyword is not valid when CRTBNDRPG is used to create a programA 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. Set dftactgrp(*no) in the control specification or on the command.
  • Compiling NOMAIN source with CRTBNDRPG. See the table above.
  • Expecting ACTGRP to apply with DFTACTGRP(*YES). IBM says you cannot use it then.
  • Using *NEW for every program. Each call then creates a new activation group. Pick a named group or *CALLER deliberately.
  • Relying on SRCSTMF without testing it. On the PUB400 system used to check this site (IBM i V7R5M0), compiles with SRCSTMF(...) failed with RNS9339: 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

CommandRelation
CRTRPGMODCompiles to a module instead of a program
CRTPGMBinds several modules and service programs into a program
CRTSRVPGMCreates 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

  • CRTBNDRPG compiles one source member into a *PGM.
  • The default DFTACTGRP(*YES) rules out BNDDIR, ACTGRP and static binding.
  • NOMAIN source needs CRTRPGMOD and then CRTPGM or CRTSRVPGM.
  • 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.

Leave a Comment

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

Scroll to Top