SQL’s PREPARE statement, combined with ILE RPG, can bring unmatched flexibility to your application’s code. Read on to find how you can do it. It’s easier than you think!
By Rafael Victória-Pereira
Using thePREPARE SQL instruction, you can have a single cursor and use it according to conditions defined by user input, for instance. I’ve seen subfiles with different columns, selections, and sorting being managed with a single cursor. How, you might ask? The PREPARESQL instruction allows you to define a cursor loosely: