Called and calling program for cobol with cursor

I have program A which is calling B first time. B program is feaching data using cursor , but some mess happened and the control went back to pro A without closing cursor . Once again program A called program B then what will happen to cursor. will program fetch the data.

Questions by harish.jamkhande

Showing Answers 1 - 4 of 4 Answers


  • Jul 16th, 2012

Program B will throw an error while it is trying to open the cursor again, which is already opened.

  Was this answer useful?  Yes


  • Jan 22nd, 2014

I think it will throw SQL error code -502 i.e. when it will try to open the cursor that is already open.

  Was this answer useful?  Yes

Anand Jeyapaul

  • Oct 25th, 2017

How do we avoid the error code of -502? How do we close the cursor in the calling program?

  Was this answer useful?  Yes


  • Mar 20th, 2018

It depends on how program b is linked. Above answer is correct for statically linked. But if dynamically linked then program b will be in initial state in 2nd time and no error will come.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions