DB2 Curosr declaration in procedure division and in WS Section.

All sort of Mainframes Interview Questions.
Post Reply
Vijay Chikala
New Member
Posts: 8
Joined: Tue Jan 13, 2015 3:26 pm

DB2 Curosr declaration in procedure division and in WS Section.

Post by Vijay Chikala »

Hi,

If we declare the curosr in procedure division and if we declare it in WS Section, wil lthat make any difference in the two? If yes, what are the differneces.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: DB2 Curosr declaration in procedure division and in WS Section.

Post by Anuj Dhawan »

There is no difference in the two as far as the definition of the CURSOR is concerned. If you declare the CUROSR in PROCEDURE DIVISION, the OPEN should logically be done after the DECLARE.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Vijay Chikala
New Member
Posts: 8
Joined: Tue Jan 13, 2015 3:26 pm

Re: DB2 Curosr declaration in procedure division and in WS Section.

Post by Vijay Chikala »

Thanks Anuj. I knew that there is no difference but was not sure about the OPEN statement. Thanks for the clarification.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: DB2 Curosr declaration in procedure division and in WS Section.

Post by Anuj Dhawan »

For instance, consider CURSOR as a variable which you'll use in your program. In most of the languages, you can use the variable in the logic of the program later, only if it is declared somewhere before it is used. Same is the case with CURSOR, unless system has its definition, it won't recognize it.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Vijay Chikala
New Member
Posts: 8
Joined: Tue Jan 13, 2015 3:26 pm

Re: DB2 Curosr declaration in procedure division and in WS Section.

Post by Vijay Chikala »

Anuj Dhawan wrote:For instance, consider CURSOR as a variable which you'll use in your program. In most of the languages, you can use the variable in the logic of the program later, only if it is declared somewhere before it is used. Same is the case with CURSOR, unless system has its definition, it won't recognize it.
You do not find such definitions in book. Thank you! :)
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 “Interview Questions.”