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
 

 

COBOL-DB2 Will the cursor be opened during second call?

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

New User


Joined: 10 Aug 2007
Posts: 38
Location: Chicago

PostPosted: Sat Aug 25, 2007 2:29 am    Post subject: COBOL-DB2 Will the cursor be opened during second call?
Reply with quote

Hello,

I have a Prog-A calling Prog-B. Inside this sub-program(Prog-B), I have a cursor and have fetched some values. Now, I want to go back to prog-A and do some processing and come back to Prog-B. When I come back to Prog-B, will the cursor that was opened during last call still be opened or closed?
If closed, is there any other way out for this problem...

If opened, will it point to the same record that it was during last call...

Please help me on this regard.

Thanks,
Dinesh
Back to top
View user's profile Send private message

stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Sat Aug 25, 2007 3:06 am    Post subject:
Reply with quote

If you are actually returning from B to A and not doing a Call to A from B you will lose and memory that was used in B that wasn't passed back to A. This includes the opened cursor. You could pass some data back to A of where you left off then when you were exiting B. Then when you come back into B reopen the cursor at that point. However there is no guarentee that this new cursor will contain the same data as the previous run into B.

Lose Cursor:
Prog A
Call Prog B
Process Data
Call Prog B

Prog B
Open cursor
return to A

Keep Cursor:
Prog A
Call Prog B

Prob B
Call Prog A

Prog A
Process data
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Sat Aug 25, 2007 4:16 am    Post subject:
Reply with quote

Hello,

If you explain what you need to do in a business sense (rather than how it is currently being implemented technically), someone here may be able to offer suggestions.
Back to top
View user's profile Send private message
dinesh_deadman
Warnings : 1

New User


Joined: 10 Aug 2007
Posts: 38
Location: Chicago

PostPosted: Sat Aug 25, 2007 4:25 am    Post subject:
Reply with quote

Thanks for the reply.....
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Sat Aug 25, 2007 4:36 am    Post subject:
Reply with quote

I don't think the OP is complaining about a problem that has occurred. I think he just does not know enough about COBOL.

OP said Pgm-A is CALLing Pgm-B.
As long as Pgm-A does not CANCEL Pgm-B before another CALL to Pgm-B

and Pgm-B does not have an INITIAL statement,

Pgm-B will reenter with the CURSOR where it belongs, as long as Pgm-B has logic to check a flag or two upon entry to determine what, where, how, and why.

Best thing is to set-up Pgm-B to react to function requests instead of too much logic trying to control everything. If Pgm-B is just doing DB2, then if it receives a request to OPEN and FETCH a CURSOR, it should do that. If the function request is to 'FETCH-NEXT' is should just do that and report any negative SQLCODES (or +100). If Pgm-B is too complicated, will be a bear to debug.

This of course talking about Batch. Does not really matter if it is Statically or Dynamically linked.
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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am


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