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

DIFFERNCE BETWEEN DECLARING A CURSOR IN DATA/PROCEDURE DIV


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
puppalso

New User


Joined: 07 Dec 2007
Posts: 8
Location: Pune

PostPosted: Wed Jan 02, 2008 2:57 pm
Reply with quote

Hi,

Please let me know the differences b/w declaring the cursor in data division Vs declaring the cursor in procedure division. icon_question.gif

Regards,
Soma
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jan 02, 2008 3:00 pm
Reply with quote

1. If you declare it in data division, you know that the DECLARE .. CURSOR will come before an open/fetch/close.

2. if you declare it in the data division, you don't have simpletons checking the sql code after the declare.
Back to top
View user's profile Send private message
puppalso

New User


Joined: 07 Dec 2007
Posts: 8
Location: Pune

PostPosted: Wed Jan 02, 2008 3:04 pm
Reply with quote

except those u have mentioned, are there any issues with declaring the cursor in data division .
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed Jan 02, 2008 3:12 pm
Reply with quote

Hi,

DECLARE is just a declaration, not a executable statement. It will give same results in both cases i.e. whether it is defined in Data Division or Procedure Division.

Reference:
• Q26 of www.geocities.com/*****/DB2.html



Regards,
Sharad Srivastava
Back to top
View user's profile Send private message
puppalso

New User


Joined: 07 Dec 2007
Posts: 8
Location: Pune

PostPosted: Wed Jan 02, 2008 3:20 pm
Reply with quote

Hi

Will there be any difference in declaring the cursor in data division while using in case of static sql/dynamic sql
Back to top
View user's profile Send private message
sharad_shanu

New User


Joined: 03 Oct 2006
Posts: 40

PostPosted: Wed Jan 02, 2008 3:33 pm
Reply with quote

Well,

As per my understanding, there should not be any difference.
Only things that matters is that, cursor should be declared before it is getting executed.

Correct me if I am wrong.

Regards,
Sharad Srivastava
Back to top
View user's profile Send private message
puppalso

New User


Joined: 07 Dec 2007
Posts: 8
Location: Pune

PostPosted: Wed Jan 02, 2008 3:48 pm
Reply with quote

Hi all,

Thanks for the clarification.
As of my knowledge there won't be any difference.
but for clarification i have posted this.

Thanks a lot...
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
This topic is locked: you cannot edit posts or make replies. Automation need help in sorting the data DFSORT/ICETOOL 38
Search our Forums:

Back to Top