This is a kind of curiosity question. Unless a COBOL program is compiled with the THREAD option and the RECURSIVE clause on the PROGRAM-ID, the program cannot CALL itself. I have also found out that if you use an ENTRY statement and the compile NAME(ALIAS), you cannot do a CALL of the alias from the "main" program either. E.g. if you have a PROGRAM-ID. A. and an ENTRY 'B', then you cannot CALL 'B' while running A. I am thinking this must be in some way related to the fact that 'A' and 'B' share the same WORKING-STORAGE area. But I was just wondering if anybody knows how this is implemented. Of course, it is probably likely to change between releases, so it's not something I could depend on.
Why the interest? Because while talking with Chuck Hardee about having an LE condition handler in the same source member (as an ENTRY) as the main COBOL routine, we found that the run-unit will abend with a U4087-2 and some messages about recursive invocation. So as a test, I compiled a sample which got the U4087-2 with the THREAD option and RECURSIVE clause, and that ran successfully. However the THREAD option comes with some possibley nasty side restrictions. In particular, no INITIAL clause in the PROGRAM-ID sentence and, worse, no use of SORT / MERGE verbs. -- Klein bottle for rent -- inquire within. Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
