Field notes
Blog
Beginner ILE RPG, Consolidated: One Program and a Best-Practices Checklist
A complete free-format ILE RPG program combining copy members, prototypes, subprocedures, file I/O, embedded SQL, and error handling — plus a review checklist.
Debugging ILE RPG with STRDBG: Breakpoints, EVAL, and WATCH
Compile with a debug view, start STRDBG with UPDPROD(*NO), set conditional breakpoints, inspect data with EVAL and hex views, and use WATCH and STRSRVJOB.
Embedded SQL in ILE RPG: Host Variables, SQLSTATE, and Nulls
SQLRPGLE, EXEC SQL, host variables and host structures, SELECT INTO, SQLSTATE checks, null indicators, SET OPTION and GET DIAGNOSTICS.
Copy Members in ILE RPG: One Definition, Everywhere It Is Used
/COPY and /INCLUDE, guarded prototype members, conditional compilation, and what belongs in a shared copy member in ILE RPG.
MONITOR and ON-ERROR: Handling Errors in ILE RPG on Purpose
MONITOR/ON-ERROR, status codes, the (E) extender with %ERROR and %STATUS, ON-EXIT, the PSDS, and why SQL errors need SQLSTATE checks.
Prototypes and Parameters in ILE RPG: Making Every Call Checkable
DCL-PR and DCL-PI, by reference vs CONST vs VALUE, *NOPASS and *OMIT, EXTPGM and EXTPROC, and program entry parameters in free-format ILE RPG.
Subprocedures in ILE RPG: Scope, Lifetime, and a Visible Contract
DCL-PROC and DCL-PI, global vs local scope, name hiding, STATIC, local files, and cycle-main vs linear-main vs NOMAIN modules in ILE RPG.
Who Owns the Record Layout? Externally Described vs Program-Described Files
How ILE RPG gets a file's layout, what the level check and CPF4131 protect, and how to handle flat files safely with DISK(length) and validation.
File I/O in ILE RPG: Five Operations, One Record Format
READ, CHAIN, WRITE, UPDATE and DELETE in free-format ILE RPG, with %EOF, %FOUND, file USAGE, and the primed read loop.