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

Declaration cursor in WS section or Procedure Division


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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
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
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
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
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
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
Reply with quote

Hi Mouli,

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

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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Invoke stored procedure via batch JCL. DB2 2
No new posts FD Section to Create FB or Vb File Dy... COBOL Programming 1
No new posts Calling COBOL DB2 program from a COBO... COBOL Programming 2
Search our Forums:

Back to Top