Repository navigation
CLI Reference
danlong005 edited this page Aug 30, 2026
·
1 revision
rpgc <source-file> [options]
| Flag | Description |
|---|---|
-o file |
Output file (executable by default, or C++ file with -S) |
-S |
Emit C++ source only, do not compile |
-c |
Compile to an object file, do not link |
-g |
Compile with debug info, for GDB/LLDB/VS Code |
--keep-cpp |
Keep the intermediate .cpp file after compiling |
-v, --version
|
Print the version and exit |
Additional .o files listed after the source file are passed through to the
linker — see Multi-Module Programs.
| Extension | Description |
|---|---|
.rpgle |
Standard RPG IV source |
.sqlrpgle |
RPG IV with embedded SQL (automatically links ODBC) |
When the input file has a .sqlrpgle extension, OpenRPG automatically adds ODBC include paths and linker flags during compilation. A program that declares a WORKSTN file likewise gets the screen runtime's linker flag added automatically — see Display Files.
The extension does not select the source format. Free-format and fixed-format are distinguished by the content of the source itself; see Fixed-Format Source.
# Compile to executable (default)
./rpgc program.rpgle # produces ./program
./rpgc program.rpgle -o myapp # produces ./myapp
# Emit C++ source only
./rpgc program.rpgle -S # produces ./program.cpp
./rpgc program.rpgle -S -o out.cpp
# Keep intermediate C++ file
./rpgc program.rpgle --keep-cpp # produces ./program and ./program.cpp
# SQL program (auto-links ODBC)
./rpgc report.sqlrpgle # produces ./report (linked with -lodbc)- 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