Subprogram containing DB2 Cursor called multiple times

Subprogram containing DB2 Cursor called multiple times

Consider the following scenario,

I have a cobol program A, which calls another cobol db2 program B, this program first closes the cursor, then opens the cursor and does a fetch but leave the cursor open at the end of program. 

Program A again calls program B, but now it passes different data to be part of where clause of declare cursor.

What would happen?

a) Sql error when B is called first time, since the cursor is not open and we are trying to close it.

b) Cursor would automatically close once the control is returned to calling program A.

c) Cursor would remain open after first call and second call would also result in proper fetch.

d)  Both a and c

e)  Both a and b

-Regds Kapil

“; ; ; ;