Declaration Cursor location in DB2.

All sort of Mainframes Interview Questions.
Post Reply
zOSHelp
Registered Member
Posts: 13
Joined: Tue Aug 20, 2013 12:52 pm

Declaration Cursor location in DB2.

Post by zOSHelp »

hi

Intwerviewer asked that, "Cusror can be declared in data division and procedure division. If declared in procedure division what care should be taken."

I did not really understand the question was not sure what exactly he wants to know, can someone here understands it and can guide.
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Declaration Cursor location in DB2.

Post by Anuj Dhawan »

Hello,

When you declare a cursor in the Procedure Division, make sure you don't issue an OPEN for it before you declare it -- because it's a procedure division, you can do so and pre-compiler and compiler won't complain about it though as a programmer you'd need to take care about it.

Hope this helps.
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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Declaration Cursor location in DB2.

Post by zprogrammer »

I would reply the value of host variable needs to be populated before doing a open cursor irrespective of the where the cursor is declared and also ensure OPEN of cursor should not be done
zprogrammer
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.”