I myself am not a great advert of using 77 level data definitions.
It cannot be re-defined, renamed or grouped.
But sometimes these are exactly the characteristics that you want!
Example:
Program A calls B, B calls C, C calls D,
D calls...ad infinitum
Suppose an exception occurs in program 'D'.
What was the cause?
The cause might originate in program 'A', or any where in between!
Than how are you supposed to know?
[that is, traverse your way down (or up) the call chain]
And return some usefull info to whatever initiated this chain of calls?
My solution:
I pass the program 'identifier' [user defined within each program!]
and 'store' this identifier in a field in the called program:
Code:
PROGRAM-ID. programC.
77 saveCallerID PIC X(100).
MOVE callerIDpassedInLinkage
TO saveCallerID
.
.
* later some other program(s), programD,
* might be called.
* programD, in turn, might call 'E',
* 'E', in turn, might call 'F', etc.
CALL programD USING ...
.
.
IF someConditionOccured
CALL logTheSavedCallerID
USING saveCallerID someOtherData
END-IF
* ...as each previous program will do
* the same, thus effectively returning
* the chain of calls [the stack].
* which can than be logically and automatically
* processed by any program higher up in
* the call hierarchy
In reality the procedure is more complex!
Notice that the 77-level callerID is never used unless an exception occurs, and even then it is merely passed to be written to some log without interest to the contents of this field.
I never want this field to be addressed, sub devided or being overwritten.
I hope this example, and (defendable) usage of a 77-level field, was clear enough.
Any comments on the [usage of] 77-level!?!
pro/con's? Use it or not!?!
Regards, Wim Ahlers.