Repository navigation
Multi Module Programs
danlong005 edited this page Aug 30, 2026
·
3 revisions
For larger applications, split code across modules:
mathlib.rpgle (module — no main):
**FREE
CTL-OPT NOMAIN;
DCL-PROC Add EXPORT;
DCL-PI INT(10);
a INT(10) VALUE;
b INT(10) VALUE;
END-PI;
RETURN a + b;
END-PROC;main.rpgle (main program):
**FREE
DCL-PR Add INT(10) EXTPROC('Add');
a INT(10) VALUE;
b INT(10) VALUE;
END-PR;
DCL-S result INT(10);
result = Add(3 : 5);
DSPLY %CHAR(result);
RETURN;Build:
rpgc -c mathlib.rpgle # produces mathlib.o
rpgc main.rpgle mathlib.o -o myapp # compiles main and links with module- Installation
- Quick Start
- CLI Reference
- Language Basics
- Data Types
- Variables and Constants
- Data Structures
- Arrays
- Varying-Dimension Arrays
- Control Flow
- Procedures
- Procedure Overloading
- Built-In Functions
- Error Handling
- Operation Extenders
- Enumerations
- Program Status Data Structure
- Data Areas
- SND-MSG
- Embedded SQL
- Record-Level Access
- Display Files (WORKSTN)
- Program-Described Files (I-Specs and O-Specs)
- DATA-INTO and DATA-GEN
- XML-INTO
- Fixed-Format Source
- Database Connections
- Multi-Module Programs
- Environment Variables
- Testing
- Complete Example: Employee Report
- IBM i Conformance Results
- IBM i Execution Results