Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Declaration cursor in WS section or Procedure Division

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mouli

New User


Joined: 19 May 2005
Posts: 12
Location: kolkata

PostPosted: Thu Jun 02, 2005 7:06 pm    Post subject: Declaration cursor in WS section or Procedure Division
Reply with quote

Hi All,
What is the difference between declaring the cursor in working storage section and declaring in procedure divison.
Plz explain me.

Regards
Mouli
Back to top
View user's profile Send private message

ayyappa_22523
Warnings : 2

New User


Joined: 02 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Sat Jun 04, 2005 12:25 pm    Post subject:
Reply with quote

HI MOULI

declare the cursor in working-storage and procedure division is same


but most of doing in working srotage section .

urs

AyyAppA
Back to top
View user's profile Send private message
paramreddy

New User


Joined: 06 Jun 2005
Posts: 1

PostPosted: Mon Jun 06, 2005 2:50 pm    Post subject: Re: Declaration cursor in WS section or Procedure Division
Reply with quote

HI ,
U can declare the cursor position either working storage or procedure.But usually we use working storage because it is non executable statements(just is declaration of data items) .
Back to top
View user's profile Send private message
mouli

New User


Joined: 19 May 2005
Posts: 12
Location: kolkata

PostPosted: Mon Jun 06, 2005 3:11 pm    Post subject: Declaration of cursor in WS section or Procedure Division
Reply with quote

paramreddy wrote:
HI ,
U can declare the cursor position either working storage or procedure.But usually we use working storage because it is non executable statements(just is declaration of data items) .


Hi reddy,
can u explain it in detail, when should i delclare it in procedure division.

regards
mouli
Back to top
View user's profile Send private message
Pushpak

New User


Joined: 06 May 2005
Posts: 18

PostPosted: Thu Jun 09, 2005 1:25 pm    Post subject: Re: Declaration cursor in WS section or Procedure Division
Reply with quote

Hi

Its depends on you where you have to define a cursor. Only thing you have to take care is definition of cursor should be prior to the OPEN statement of the same cursor.

As definition of cursor is non executable statement, it is advisable not to define in procedure division as it may misunderstood others.

Pushpak.
Back to top
View user's profile Send private message
shailendra

New User


Joined: 08 Jun 2005
Posts: 10
Location: Pune

PostPosted: Thu Jun 09, 2005 1:48 pm    Post subject:
Reply with quote

Hi

No need to worry where to declare cursor. You can define it in procedure or working division. It does not cause any difference.

Declare cursur wherever you wish.

shailendra
Back to top
View user's profile Send private message
bnsahoo

New User


Joined: 06 Jun 2005
Posts: 18
Location: mumbai,india

PostPosted: Thu Jun 09, 2005 5:16 pm    Post subject:
Reply with quote

It is right,that there is no difference between these two .when open statement is executed then the cursor (Result Table) will be created(declared in the DECLARED statement),so it is like object is instance of class in OOconcept. That is class is blue print of object.
Thanks
Biranchi
Back to top
View user's profile Send private message
Pushpak

New User


Joined: 06 May 2005
Posts: 18

PostPosted: Fri Jun 10, 2005 3:12 pm    Post subject: Re: Declaration cursor in WS section or Procedure Division
Reply with quote

Hi All,

I am sorry for my previous statement related to this query. The statement was
"Only thing you have to take care is definition of cursor should be prior to the OPEN statement of the same cursor. "

I have tested it with DB2 Ver 7 & found that you can define CURSOR any where in the application program no matter whether it has been defined. It can be after/before OPEN/FETCH/CLOSE statements of the same cursor.

Sorry once again for your inconvenience.

Pushpak.
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Wed Jun 15, 2005 2:58 pm    Post subject:
Reply with quote

Hi Mouli,

I was answered this already ... Please refer to the following post...

http://www.ibmmainframes.com/viewtopic.php?p=4860&highlight=#4860

Thanks,
Reddy.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts Access SQLCA fields inside a stored p... gangapd DB2 4 Thu Oct 27, 2016 10:20 am
No new posts Is possible to call subprogram from c... cmsmoon COBOL Programming 3 Fri Aug 05, 2016 6:46 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us