Skip to content

CLI Reference

danlong005 edited this page Aug 30, 2026 · 1 revision

CLI Reference

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.

File Extensions

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.

Examples

# 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)

Clone this wiki locally