Da gibt's neuerdings wohl etwas von IBM:

QSYS2.GENERATE_SQL() procedure

Retrieve source from stored procedure on AS/400