ERA OF i: SQLRPGLE cursor status demonstration Prepared October 8, 2026. The author confirmed successful compilation and execution of the baseline on IBM i: CURBAD processes two orders and CURGOOD processes all five. Compiler listings and job-log transcripts are not included. Requirements - Development IBM i partition with fully free RPG and the SQL RPG precompiler. - ACS Run SQL Scripts for setup (SQL naming). - A development profile authorized to create and use the fixture objects. - EOICURSOR must be unused. If it already exists, choose another schema name consistently throughout the setup, source, and commands. Do not overwrite it. Setup 1. Run setup.sql once. Stop on errors. It creates the schema and two tables. 2. Confirm five orders with IDs 1 through 5; only order 2 has promo NONE. 3. Upload both .sqlrpgle files as correctly tagged UTF-8 IFS stream files to /home/YOURPROFILE/cursor-status/ (substitute your actual path). 4. Run each CL command separately. Stop if either compile fails. Preserve the compiler listings. REPLACE(*NO) prevents replacement of existing programs. CRTSQLRPGI OBJ(EOICURSOR/CURBAD) SRCSTMF('/home/YOURPROFILE/cursor-status/cursor-broken.sqlrpgle') OBJTYPE(*PGM) COMMIT(*NONE) OPTION(*SQL) DBGVIEW(*SOURCE) USRPRF(*USER) REPLACE(*NO) CRTSQLRPGI OBJ(EOICURSOR/CURGOOD) SRCSTMF('/home/YOURPROFILE/cursor-status/cursor-fixed.sqlrpgle') OBJTYPE(*PGM) COMMIT(*NONE) OPTION(*SQL) DBGVIEW(*SOURCE) USRPRF(*USER) REPLACE(*NO) Run in an interactive job; review the DSPLY messages/job log: CALL PGM(EOICURSOR/CURBAD) CALL PGM(EOICURSOR/CURGOOD) Baseline acceptance criteria (author-confirmed on IBM i) - CURBAD displays orders 1 and 2, then Rows processed=2 and Stopped before FETCH reported end-of-data. - CURGOOD displays orders 1 through 5, then Rows processed=5 and Complete: FETCH reached end-of-data. - The lookup for order 2 returns +100; its discount is zero in both programs. - The final FETCH in CURGOOD returns +100; only this marks normal cursor end. - There are no OPEN, FETCH, LOOKUP, or CLOSE warning/error messages. - DSPLY numeric formatting may include decimal signs/spacing; compare values. Additional suggested cases (not included in the baseline confirmation) Use only this disposable fixture. 1. Make order 2 match: UPDATE EOICURSOR.ORDERS SET PROMO_CODE='SAVE10' WHERE ORDER_ID=2; Both programs should process five rows and reach FETCH end-of-data. Restore with PROMO_CODE='NONE' afterward. 2. Make order 1 unmatched too: UPDATE EOICURSOR.ORDERS SET PROMO_CODE='NONE' WHERE ORDER_ID=1; Broken: one processed row; fixed: five. Restore order 1 to SAVE10 afterward. 3. Empty result: temporarily change each cursor SELECT to add WHERE ORDER_ID < 0 before ORDER BY; recompile the two fixture programs deliberately with REPLACE(*YES). Both should process zero rows and report cursor end. 4. Return to the original source and data, recompile, and repeat the baseline. Record release/PTF level, compiler diagnostics, source changes, and actual messages for each case before describing the examples as tested. Scope The programs read, display, and count synthetic data. They perform no business updates. COMMIT(*NONE) is for this read-only demonstration, not transaction guidance. A missing promotion means zero discount only in this example. The examples stop on unexpected codes, SQLSTATE values, or SQLWARN flags. They display diagnostic status; production callers need an explicit error contract, and should not infer business success from a normal program return. These are single-row forward FETCH examples, not rowset-fetch templates. Files setup.sql Synthetic schema and data cursor-broken.sqlrpgle Deliberately incorrect loop condition cursor-fixed.sqlrpgle Explicit FETCH-controlled exit Documentation https://www.ibm.com/docs/en/i/7.5.0?topic=codes-sqlcode-sqlstate-concepts https://www.ibm.com/docs/en/i/7.6.0?topic=area-field-descriptions https://www.ibm.com/docs/en/i/7.5.0?topic=codes-listing-sql-messages https://www.ibm.com/docs/en/i/7.5.0?topic=ssw_ibm_i_75%2Fcl%2Fcrtsqlrpgi.htm