Declare same Cursor more than once in a program?

RDBMS from IBM and IBM's Hierarchical DBMS and Transaction Manager (IMS DC).
Post Reply
Abhishek Dimri
New Member
Posts: 7
Joined: Mon May 26, 2014 10:58 am

Declare same Cursor more than once in a program?

Post by Abhishek Dimri »

Hi,

In a COBOL program, I have to fecth data from more than one table.The tables, we need to refer, are cahnged dynamically based upon a column value m say COL1. We have different tables defined for each COL1. Using some mechanism, we'd calculate the value for COL1 in theprogram and based on that, we need to call one or many tables.

To do that, do you think, is it possible to declare the same cursor multiple times, each time for differet value of COl1 to refer to that tabless?
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Declare same Cursor more than once in a program?

Post by zprogrammer »

Based on COL1 , You could have different cursor
zprogrammer
Abhishek Dimri
New Member
Posts: 7
Joined: Mon May 26, 2014 10:58 am

Re: Declare same Cursor more than once in a program?

Post by Abhishek Dimri »

Thanks but that does not seem to answer the question I've asked and the question is "is it possible to declare the same cursor multiple times"?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Declare same Cursor more than once in a program?

Post by nicc »

"same cursor" - why waste time coding it more than once? And you would probably choke the pre-processor but if you didn't then when duplicates appear it is usually, but not always, the last occurrence that is taken.

Why not just code up a dummy program that exhibits the characteristics you want and try compiling it?
Regards
Nic
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM DB2 and IMS DB/DC”