Hallo *all,

ich habe zu meinem Problem im Cobol Handbuch nachgelesen, aber die Lösung nicht gefunden.

Problem:
Programm A (OPM-Cobol) ruft Programm B (ILE-Cobol / Dynamic Programm Call) auf, setzt eine Variable und kehrt mit go back zurück.

Ich hätte erwartet das die Variable bei erneutem Aufruf noch den alten Wert hat.
Hat er aber nicht.
Eine Initalisierung nehme ich nicht vor.

Im Handbuch steht:
Returning from a SubprogramTo return control from a subprogram, the subprogram may end with an EXITPROGRAM, a GOBACK, or a STOP RUN statement. If the subprogram ends withan EXIT PROGRAM or a GOBACK statement, control returns to its immediatecaller without ending the run unit. An implicit EXIT PROGRAM statement isgenerated if there is no next executable statement in a called program. If thesubprogram ends with a STOP RUN statement, all programs in the run unit up tothe nearest control boundary are ended, and control returns to the program priorto the control boundary.A subprogram is usually left in its last-used state when it ends with EXITPROGRAM or GOBACK. The next time it is called in the run unit, its internalvalues will be as they were left, except that all PERFORM statements areconsidered to be complete and will be reset to their initial values. In contrast, amain program is initialized each time it is called. There are two exceptions:v A subprogram that is dynamically called and then canceled will be in the initialstate the next time it is called.v A program, which has the INITIAL clause specified in its PROGRAM-IDparagraph, will be in the initial state each time it is called.224 ILE COBOL Programmer’s Guide."

Was muß ich machen damit die Werte erhalten bleiben?

GG