Previous Topic Next topic Print topic


To change a SELECT (cursor) query to do an array FETCH

  1. Check your OpenESQL Assistant configuration and be sure that the Use SQL TYPE check box is unchecked. This is necessary because the compiler does not support OCCURS clauses defined with SQL TYPE host variables.
  2. In the IDE, open the project that contains the program that contains the SELECT (cursor) query you want to modify.
  3. Open the appropriate program in your program editor.
  4. Locate the FETCH statement in the code generated for SELECT (cursor) statements.
  5. Remove the comments that appear before and between the PERFORM and END-PERFORM statements.
  6. Place your cursor between the PERFORM and END-PERFORM statements.
  7. In the OpenESQL Assistant, click the Auxiliary Code tab.
  8. Click Host Variables.
  9. In the Host Variable Array Size field, type the number that represents the maximum number of rows you want returned for each array FETCH.
  10. Embed the code into the program using the instructions given in To generate and embed auxiliary code .
Note: If you decide to code the PERFORM without using code generated by OpenESQL Assistant, you should either define the index variable IDX or modify the code to use a variable that has been already defined to process the array loop.
Previous Topic Next topic Print topic