Using SELECT and SET in embedded SQL statements is not enough for you? Time to learn how to use SQL cursors to access data!
By Rafael Victória-Pereira
So far, I’ve embedded SQL to take advantage of its functions. Now let’s see how you can replace data access using SQL. Before your mind starts wondering, note that I’m not suggesting that you replace all your data access with SQL statements; for single-table, keyed-record access, SQL is usually inferior to RPG’s CHAIN operation. However, SQL is a more than fit replacement for Open Query File access or multiple-table access, typically written in RPG with a series of sequential READ/CHAIN operations in which each operation provides the key to the next.