Hi,
Our customer has got a peculiar problem and describes as told below:
There is a DB2-COBOL program that uses a cursor to fetch data from a table based upon some condition. If the internal table reaches a said limit that program abends. We can't predict the number of entries coming into the internal table, so, the program abends every now and then and cusomer is very unhappy.
We suggested a dynamic array (occurs depending on) but he asks how to set the maximum value because of unknown entries coming for a particular day.
Can anybody help me out please........this is very urgent......
Please let me know if you need more details.
Thank you very much.........
Best Regards.
urgent - dynamic array.
Moderators: dbzTHEdinosauer, Moderator Group
urgent - dynamic array.
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
Hi ArrBee,
DEPENDING ON Clause in COBOL.. is not fully dynamic...
i.e. you need to define the range.
If you want to use DEPENDING ON clause... you should now
how many records you will get between range ...
Ex. If you are expecting... your no of records from cursor is always
between a range. ex. 1000 to 2000. then you can define
internal table using DEPENDING ON.
In your case, i suggest, use SELECT count(*)... before fetching records from cursor.... to know number of records you are going to fetch from cursor.
so that... before fetch records from cursor... you can set the index value to
that no. of records value....
DEPENDING ON Clause in COBOL.. is not fully dynamic...
i.e. you need to define the range.
If you want to use DEPENDING ON clause... you should now
how many records you will get between range ...
Ex. If you are expecting... your no of records from cursor is always
between a range. ex. 1000 to 2000. then you can define
internal table using DEPENDING ON.
In your case, i suggest, use SELECT count(*)... before fetching records from cursor.... to know number of records you are going to fetch from cursor.
so that... before fetch records from cursor... you can set the index value to
that no. of records value....
Regards,
Krishna
Facebook --> http://www.facebook.com/mainframegurukul
Connect with RAMESH KRISHNA REDDY --> http://www.linkedin.com/in/rameshkrishnareddy
Twitter --> https://twitter.com/mainframegurkul
http://www.mainframetutorials.com
Krishna
Facebook --> http://www.facebook.com/mainframegurukul
Connect with RAMESH KRISHNA REDDY --> http://www.linkedin.com/in/rameshkrishnareddy
Twitter --> https://twitter.com/mainframegurkul
http://www.mainframetutorials.com
would you please elaborate.
Krishna,
Thank you very much for the solution.
would you please explain me the following lines in detail:
Thank you very much for the solution.
would you please explain me the following lines in detail:
Thanks.In your case, i suggest, use SELECT count(*)... before fetching records from cursor.... to know number of records you are going to fetch from cursor.
so that... before fetch records from cursor... you can set the index value to
that no. of records value....
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
Hi Arr Bee,
Please find more details on my points.
your cursor. i.e. this select query contains same where clause as your cursor.
But in select you will use COUNT(*).
Using this query you can know... how many records your cursor is going to return.
Set this value to DEPENDING ON clause variable.
Continue with your existing cursor open.. fetch... logic...
it will work fine.
Let me know, if you have any other questions..
Please find more details on my points.
In addition to existing cursor, you need to add one more Select query similar to
In your case, i suggest, use SELECT count(*)... before fetching records from cursor.... to know number of records you are going to fetch from cursor.
your cursor. i.e. this select query contains same where clause as your cursor.
But in select you will use COUNT(*).
Using this query you can know... how many records your cursor is going to return.
Once you get the no. of records from the select count query.so that... before fetch records from cursor... you can set the index value to
that no. of records value....
Set this value to DEPENDING ON clause variable.
Continue with your existing cursor open.. fetch... logic...
it will work fine.
Let me know, if you have any other questions..
Regards,
Krishna
Facebook --> http://www.facebook.com/mainframegurukul
Connect with RAMESH KRISHNA REDDY --> http://www.linkedin.com/in/rameshkrishnareddy
Twitter --> https://twitter.com/mainframegurkul
http://www.mainframetutorials.com
Krishna
Facebook --> http://www.facebook.com/mainframegurukul
Connect with RAMESH KRISHNA REDDY --> http://www.linkedin.com/in/rameshkrishnareddy
Twitter --> https://twitter.com/mainframegurkul
http://www.mainframetutorials.com
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page