I would use SQL.
If you need to do it within an RPG program, imbed the SQL to do the record select.
Register Hereor login if you are already a member
c+ insert into STMTIDXDB
c+ (CUNUM, SYSTEM, PRN, AGENT, ACCOUNT#, STMTTYPE,
c+ STATEMENT_DATE, STATEMENT_DATA)
c+ values (:prCuNum, :prSys, :prPrn, :prAgt, :prAccount, :vStmtType,
c+ :statementDate, :vPdfFile)