It is most likely a problem of (1) a mismatch between parameters passed to this program and the arguments received by this program or (2) a mismatch between parameters passed by this program to a called program or procedure and the arguments received by the called program/procedure (or similarly inside a called program/procedure). If you are explicitly using pointers in your programming, that would be another likely source.
Memory is being corrupted somewhere. The corruption becomes apparent when CHAIN is executed. Perhaps an offset value used for I/O buffering by CHAIN was accidentally altered.
It’s also possible that you are not at a decent PTF level. I would check cume level against <a href=”http://www-912.ibm.com/s_dir/sline003.nsf/ALLPSPBYREL”>PSP by Release</a> and group PTF levels (WRKPTFGRP) against <a href=”http://www-912.ibm.com/s_dir/sline003.nsf/GroupPTFs?OpenView&view=GroupPTFs”>Group PTFs by Release</a> particularly for DB2 just in case.
PTF levels are simply good system practice. I would be certain that no parameter mismatches existed before thinking it was a PTF issue, especially if I had anything close to current PTF levels. There are too many other sites running RPG against DB2 for system bugs to go unnoticed.