Article ID: 108116
When calling a CA Ideal subprogram, is there a way to cause the working data fields to be reset to their initial state with each call?
First, when calling a subprogram in COBOL or another non-Ideal language, there is a “new copy on call” option in case the code itself is not reusable, and since the code and data are kept together, a reload of the program also loads a fresh set of data. The nature of CA Ideal programs is that the program code is reusable and the data is held in storage separately from the program code. As a result, when you call the CA Ideal subprogram the first time, the data fields loaded into storage with their initial values, but the data is kept in storage as it was when the subprogram ends.
This means that the next time that the subprogram is called, the program starts with the data as it was when the previous use ended - CA Ideal subprogram data is not reset.
Since the data is maintained "as is" between executions of a subprogram, the way to ensure the data is initialized correctly is to initialize the data fields either when subprogram starts processing, or before exiting the program. There is a way to release a subprogram after using it, which will force a load of program and data at the next call, but this is strongly advised against, as this process adds a great deal of overhead to the execution.
As always, please contact CA Technologies support for CA Datacom if you have further questions.