Problem:
Release 4.0:
We are on the way of migrating our OS/390 CSP-written programms to Cobol using Micro Focus Net Express. So far so good, now comes a nasty 166 error saying:
"RECURSIVE COBOL CALL is illegal."
The situation is as follows:
start pgm -----> pgma -----> pgmb -----> pgmc (PF3) -----> pgma
call call call call
error 166
How to get around this problem ?
Resolution:
By default, this last call to pgma is recursive while pgma does not get an 'EXIT PROGRAM' before. Therefore, the same run unit remains addressed in that run time system.
On the other hand, you should consider about the following:
1) In fact, if you want to have a recursive environment you can note down this as follows and compile again:
program-id. pgma is recursive.
However, be aware of the initial status of all data involved in that case at run time, refer to:
Help Topics -> Index -> Program-id Paragraph -> EXTERNAL PROGRAM clause -> The Program-ID Paragraph
'General Rules' Format 2 , under 6. this link to 'Common, Initial and Recursive Attribute' in 'Language Fundamentals'. also linked to: ' State of a Function, Method, Object or Program'
-> Initial and Last-used States of Data
2) Consider of replacing CALL by CHAIN if you have a straightforward architecture because:
>
The CHAIN statement transfers control from one object program to another in the run unit with no subsequent return of control. The effect is as though the chained program is the main program in the new run unit.
<