View previous topic :: View next topic
|
Author |
Message |
mouli
New User
Joined: 19 May 2005 Posts: 12 Location: kolkata
|
|
|
|
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 |
|
|
ayyappa_22523 Warnings : 2 New User
Joined: 02 Jun 2005 Posts: 36 Location: Hyderabad
|
|
|
|
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 |
|
|
paramreddy
New User
Joined: 06 Jun 2005 Posts: 1
|
|
|
|
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 |
|
|
mouli
New User
Joined: 19 May 2005 Posts: 12 Location: kolkata
|
|
|
|
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 |
|
|
Pushpak
New User
Joined: 06 May 2005 Posts: 18
|
|
|
|
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 |
|
|
shailendra
New User
Joined: 08 Jun 2005 Posts: 10 Location: Pune
|
|
|
|
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 |
|
|
bnsahoo
New User
Joined: 06 Jun 2005 Posts: 18 Location: mumbai,india
|
|
|
|
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 |
|
|
Pushpak
New User
Joined: 06 May 2005 Posts: 18
|
|
|
|
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 |
|
|
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
|
|
Back to top |
|
|
|