support: Customer Portal
Focused on delivering choice, investment protection and flexibility to organizations with valuable COBOL assets
 

Veryant Knowledge Base
Home > All Categories > Data Access > COBOL/ESQL and Veryant ESQL Generator > How is READ NEXT implemented in isCOBOL ESQL Generator (EasyDB)?
Question Title How is READ NEXT implemented in isCOBOL ESQL Generator (EasyDB)?
The START statement creates a cursor, and READ NEXT/PREVIOUS fetches the cursor. Using the isCOBOL debugger, you can step into the READ NEXT and the source code for the bridge programs generated by edbiis.exe to give you a better understanding of how this works.

By default, each elementary item maps to a separate column in the RDBMS. In order to read rows ordered by a composite key, the generated code uses multiple cursors successively with different where clauses. 

(Note that you can use the EFD USE-GROUP directive to instruct the isCOBOL ESQL Generator to store a composite key in a single column in the table. See the isCOBOL APS Documentation : isCOBOL ESQL Generator : Using EFD directives : USE GROUP Directive for more information.)

Here is an example:

With the following FD key:

FD ACC.
01 ACC-REC.
05 ACC-KEY.
10 ACC-ID PIC 9(6).
10 ACC-TY PIC 9(3).
10 ACC-CU PIC 9(3).
10 ACC-BR PIC 9(3).
10 ACC-IN-CD PIC 9(2).

If you look at the generated code you will see the following WHERE clauses:

where (ACC_ID = ? and ACC_TY = ? and ACC_CU = ? and ACC_BR = ? and ACC_IN_CD >= ?)

where (ACC_ID = ? and ACC_TY = ? and ACC_CU = ? and ACC_BR > ?)

where (ACC_ID = ? and ACC_TY = ? and ACC_CU > ?)

where (ACC_ID = ? and ACC_TY > ?)

where (ACC_ID > ?)

so that if ACC-KEY is 00000100200300405 then the code for START ACC KEY NOT < ACC-KEY followed by a READ NEXT loop first uses:

where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU = 3 and ACC_BR = 4 and ACC_IN_CD >= 5) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD

and after returning all of the rows in that result set (or if the result set it empty), then the code uses

where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU = 3 and ACC_BR > 4) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD

and after returning all of the rows in that result set (or if the result set it empty), then the code uses

where (ACC_ID = 1 and ACC_TY = 2 and ACC_CU > 3) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD

and after returning all of the rows in that result set (or if the result set it empty), then the code uses

where (ACC_ID = 1 and ACC_TY > 2) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD

and after returning all of the rows in that result set (or if the result set it empty), then the code uses

where (ACC_ID > 1) order by ACC_ID, ACC_TY, ACC_BR, ACC_IN_CD

Authored by: Veryant Support This question has been viewed 4484 times so far.
Click Here to View all the questions in COBOL/ESQL and Veryant ESQL Generator category.
File Attachments File Attachments
There are no attachment file(s) related to this question.
How helpful was this article to you?
User Comments User Comments Add Comment
There are no user comments for this question. Be the first to post a comment. Click Here
Related Questions Related Questions
  1. Does isCOBOL support PostgreSQL?
  2. How do I set up isCOBOL ESQL Generator for use with Microsoft SQL Server?
  3. How do I use isCOBOL ESQL with Microsoft SQL Server?
  4. How do I connect to a MS SQL 2005 Named Instance?
  5. How do I migrate a Vision file to an Oracle database table?
  6. Set iscobol.jdbc.autocommit=false when using ESQL in TP environments
  7. Where is the Veryant ESQL Generator? What files do I download?
  8. How does isCOBOL limit the size of database query working set for the START statement?
  9. How do I set up isCOBOL ESQL Generator for use with Microsoft SQL Server?
  10. How do I get isCOBOL to create a database table when iscobol.file_suffix is set?
  11. How is it possible to insert a NULL into an ORACLE TABLE when host variable has been initialized?
Article Information Additional Information
Article Number: 71
Created: 2009-09-02 12:39 PM
Rating: 1 Star
 
Article Options Article Options
Print Question Print this Question
Email Question Email Question to Friend
Export to Adobe PDF Export to PDF File
Export to MS Word Export to MS Word
Bookmark Article
Subscribe to Article Subscribe to Article
 
Search Knowledge Base Search Knowledge Base



 
 

© Veryant - All Rights Reserved
Veryant and isCOBOL are trademarks or registered marks of Veryant in the United States and other countries. All other marks are the property of their respective owners.