CRTSRVPGM (Create Service Program) binds one or more modules into a service program, *SRVPGM: a set of exported procedures and data that other programs call. This page is the lookup for the command’s parameters and defaults. It owns the command. The service program as an object, and why you would build one, are in the RPGLE Service Programs Reference.
For a step-by-step build, read Build an ILE RPG Service Program.
At a glance
| Question | Answer |
|---|---|
| What does it create? | A *SRVPGM with no entry point of its own |
| What does it need? | One or more modules, usually NOMAIN, made with CRTRPGMOD |
| What decides the public interface? | The EXPORT parameter, normally with binder source |
| What decides the activation group? | ACTGRP, which is *CALLER by default. *NEW is not a value for a service program |
| Rebuild it later? | Run CRTSRVPGM again with REPLACE(*YES), or use UPDSRVPGM to replace modules |
Parameters that matter
Defaults are those on the IBM i 7.5 command page.
| Parameter | Default | What it decides |
|---|---|---|
SRVPGM | required | The service program name and library |
MODULE | *SRVPGM | The modules copied and bound together, up to 300. *SRVPGM means one module with the same name as the service program |
EXPORT | *SRCFILE | *SRCFILE reads EXPORT statements from binder source in the file and member named by SRCFILE and SRCMBR, or in SRCSTMF. *ALL exports everything the modules export |
SRCFILE | QSRVSRC | The source file that holds the binder source |
SRCMBR | *SRVPGM | The binder source member. *SRVPGM means the member has the service program’s name |
SRCSTMF | none | Binder source in a stream file |
BNDSRVPGM | *NONE | Service programs whose exports are examined to resolve imports, each with *IMMED or *DEFER activation, up to 300 |
BNDDIR | *NONE | Binding directories searched to resolve imports, up to 300 |
ACTGRP | *CALLER | *CALLER or a group name. IBM does not list *NEW for a service program |
OPTION | none set | Binder options such as *DUPPROC and *NODUPPROC, *WARN and *NOWARN, *RSLVREF and *UNRSLVREF |
DETAIL | *NONE | The binder listing: *BASIC, *EXTENDED or *FULL |
ALWUPD | *YES | Whether the service program may be updated later |
ALWLIBUPD | *NO | Whether the library of a bound service program may be changed on update |
USRPRF | *USER | *USER runs with the caller’s authority. *OWNER adds the owner’s authority |
REPLACE | *YES | Replace an existing service program of the same name |
AUT | *LIBCRTAUT | Public authority of the new object |
TEXT | *BLANK | The description. *EXPORTSRC and *MODULE copy text from the binder source or module |
TGTRLS | *CURRENT | The release the service program must run on |
STGMDL | *SNGLVL | The storage model |
EXPORT: binder source or everything
| Value | Public interface | Signature | Use when |
|---|---|---|---|
*SRCFILE | Only the symbols named in the binder source | You control it with SIGNATURE and PGMLVL | The service program has callers you cannot rebuild, and the interface has to stay compatible |
*ALL | Every procedure and data item the modules export | Generated from the exports | A private service program with callers you rebuild, or while you are experimenting |
Binder source, signatures and PGMLVL(*PRV) blocks are in the RPGLE Binder Language and Signatures Reference.
Example
CRTSRVPGM SRVPGM(MYLIB/REFUTIL) MODULE(MYLIB/REFUTIL) EXPORT(*SRCFILE) SRCFILE(MYLIB/QSRVSRC) SRCMBR(REFUTIL) ACTGRP(*CALLER) DETAIL(*EXTENDED)
The binder source member REFUTIL holds:
STRPGMEXP PGMLVL(*CURRENT) SIGNATURE('REFUTIL_VERSION1')
EXPORT SYMBOL('REFDOUBLE')
EXPORT SYMBOL('REFLABEL')
ENDPGMEXP
Result: a *SRVPGM named REFUTIL that exports REFDOUBLE and REFLABEL under one signature, and runs in the caller’s activation group. DSPSRVPGM SRVPGM(MYLIB/REFUTIL) DETAIL(*PROCEXP) lists the two procedures. A caller binds to it with BNDSRVPGM on CRTPGM or through a binding directory, as in the RPGLE Binding Directories Reference.
Common mistakes
- Ignoring the
EXPORTdefault. The default is*SRCFILE, so the command expects binder source inQSRVSRCwith the service program’s name. If yours is elsewhere, name the file and member, or useEXPORT(*ALL). - Using
*ALLfor a public service program. Any procedure you export later changes the signature, and callers bound to the old one fail. See the signature error in CRTPGM. - Changing the order of
EXPORTstatements. IBM says that for a compatible change you add new exports at the end and keep the old signature in a*PRVblock. - Choosing
ACTGRP(*NEW). It is not a value for a service program. Use*CALLER, or a named group when the service program holds state of its own. See the RPGLE Activation Groups Reference. - Rebuilding with
CRTSRVPGMand expecting callers to follow. A new signature does not reach programs that were bound to the old one unless the old signature is kept. - Relying on
SRCSTMFfor the binder source without testing it. The PUB400 problem was recorded for RPG compiles. Binder source was copied into a source file member and used withSRCFILE.
Related commands
| Command | Relation |
|---|---|
| CRTRPGMOD | Creates the modules to bind |
| CRTPGM | Binds a program to the service program |
| UPDSRVPGM and DSPSRVPGM | Replace modules in it, and inspect it |
CRTBNDDIR, ADDBNDDIRE | Make the service program findable at bind time. See the RPGLE Binding Directories Reference |
FAQ
What does CRTSRVPGM create?
A service program object, *SRVPGM, bound from modules. It has no entry point of its own, so you call its exported procedures from other ILE programs.
What is the difference between EXPORT(SRCFILE) and EXPORT(ALL)?
*SRCFILE exports only what binder source names. *ALL exports everything the modules export.
Can a service program run in a new activation group?
IBM does not list *NEW as a value for a service program. Use *CALLER or a named group.
How do I change a service program without breaking callers?
Keep the old signature in a PGMLVL(*PRV) block, add new exports at the end, and replace the modules with UPDSRVPGM or rebuild with CRTSRVPGM.
Summary
CRTSRVPGMbinds modules into a*SRVPGMthat other programs call.EXPORT(*SRCFILE), the default, uses binder source.EXPORT(*ALL)exports everything the modules export.ACTGRPdefaults to*CALLER.*NEWis not a service program value.- Signature control is what keeps old callers working.
Sources: IBM i 7.5 CRTSRVPGM command (parameters, defaults, EXPORT, ACTGRP) and IBM i 7.5 ILE Concepts. On IBM i V7R5M0 (PUB400, 2026-10-07) the example built REFUTIL from binder source and DSPSRVPGM listed the procedures and signature (steps B02 to B04). The EXPORT(*ALL) behaviour, the parameter table and the statements about export order were checked against IBM documentation only and were not run.