How to reset the active state of an active subroutine?


We have a mixed language system, C main program and COBOL sub programs.

runner.c -–(cobcall)--> a.cbl --(call)--> jump.c --(cobcall)--> b.cbl

After exiting subroutine b by using longjmp (going back to jump.c), we are trying (in a.cbl) to do a CANCEL “b”. This does not work:

Load error : file 'b', 177 Attempt to cancel active program

Obviously, there is an active flag or active counter, which gets not reset or decremented by longjmp. A CALL “b” thus stops with:

Execution error : file 'b', 166 Recursive COBOL CALL is illegal

Does anybody know, how to reset the active state of an active subroutine?

Why are we not using coblongjmp, which will safely eliminate this problem? We would happily do, but starting with Visual Cobol 5, Micro Focus has changed the behavior of coblongjmp so that it will refuse to work in some situations. Unfortunately, we are in one of these situations.


Comment List
  • Hi, 

    no, there is no local-storage section. We normally use the compiler option NORECURSECHECK so we will never get a run time error 166.

    For this test case I did not use NORECURSECHECK to prove, that the subroutine is still active

    Nevertheless, I have tried your proposal, and as expected: error 166 is gone, error 177 is still there.

    Best regards


  • do you have include "local-storage section." in your program?

    this must be included, but can keep empty for recursive Operation! This is my experience by netexpress an vc

    Test it and give Feedback, please!

Related Discussions