IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Diff in declaring the cursors in WSS and Procedure div


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kvskris
Currently Banned

New User


Joined: 16 Sep 2006
Posts: 12

PostPosted: Thu Dec 21, 2006 9:08 am
Reply with quote

hello everybody,

i want to know the what is the use of declaring a cursor in the working-storage section rather declaring it in the procedure division.

please help me, this is an interview question.

thanking you all,

kumar
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Dec 21, 2006 4:17 pm
Reply with quote

IIRC, declaring cursors is not a program executable process, it is needed by the database preprocessor. Putting it in working storage reduces the procedure division clutter.
Back to top
View user's profile Send private message
nasser_tice

New User


Joined: 28 Nov 2006
Posts: 19
Location: India

PostPosted: Thu Dec 21, 2006 8:29 pm
Reply with quote

Hi Thompson,

Could you please explain a little bit clearly to the most Freq. asked Question, what is the diff between declaring a cursor in Procedure Division and Working Storage section....

What happens if we declare it in Procedure Division and What happends if we declare in WS of Data Division..?
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Dec 21, 2006 8:39 pm
Reply with quote

IIRC, nothing happens either way, it is non executable, (I think) it just needs to be visible to the precompiler prior to the cursor beiing used in the procedure division.
Back to top
View user's profile Send private message
Yuvaraj BP

New User


Joined: 12 Oct 2006
Posts: 12
Location: Bangalore

PostPosted: Sun Dec 24, 2006 7:09 am
Reply with quote

Hai,

To my theoritical knowledge, I think the program will execute successfully but the problem will be with the performance of your program with respect to speed of execution.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sun Dec 24, 2006 7:18 am
Reply with quote

Yuvaraj BP wrote:
To my theoritical knowledge, I think the program will execute successfully but the problem will be with the performance of your program with respect to speed of execution.
HUH? icon_question.gif
A lot of words with little said.....Where does the "performance" difference or problem occur in regards to where the cursor is declared? icon_rolleyes.gif
Back to top
View user's profile Send private message
Yuvaraj BP

New User


Joined: 12 Oct 2006
Posts: 12
Location: Bangalore

PostPosted: Sun Dec 24, 2006 7:25 am
Reply with quote

when the cursor is declared in the procedure division execution of your program will be slower than that of declaring it in the ws section
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Sun Dec 24, 2006 7:33 am
Reply with quote

Yuvaraj BP wrote:
when the cursor is declared in the procedure division execution of your program will be slower than that of declaring it in the ws section
I admit it when I do not know the answer, but this I have never heard. Give me a source or reference to this, Please.....
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Dec 26, 2006 11:17 am
Reply with quote

Hi Yuvaraj ,

I don't think so & I m agree with William Declare cursor is non executable stmt it does not make any difference whether we declare it in working storage or procedure division it should be declare before open cursor stmt.
Back to top
View user's profile Send private message
nasser_tice

New User


Joined: 28 Nov 2006
Posts: 19
Location: India

PostPosted: Sun Dec 16, 2007 5:22 pm
Reply with quote

Yuvraj/Ekta/William,

The answers are not clear as for what happens exactly when we declare a Cursor in Procedure Division and WS Section. \

Can anybody else help on this.. :|
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Dec 17, 2007 8:44 am
Reply with quote

Hello,

Replying to a topic that is nearly a year old is usually not recommended.

The answer given in the replies is that it makes no difference.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts Positioned Deletes/Updates using curs... DB2 3
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
No new posts Cond parameter and Rc code of a proce... JCL & VSAM 5
This topic is locked: you cannot edit posts or make replies. Internal Autonomous Stored Procedure ... DB2 6
Search our Forums:

Back to Top