PERFORM UNTIL ALL-ACCOUNTS-SETTLED
⋮
CALL "SUBPROGA" USING CURRENT-ACCOUNT
ON OVERFLOW
CANCEL "SUBPROGB"
CALL "SUBPROGA" USING CURRENT-ACCOUNT
END-CALL
END-CALL
⋮
CALL "SUBPROGB" USING CURRENT-ACCOUNT
ON OVERFLOW
CANCEL "SUBPROGA"
CALL "SUBPROGB" USING CURRENT-ACCOUNT
END-CALL
END-CALL
⋮
END-PERFORM
The assumption is that for some executions of this program, SUBPROGA and SUBPROGB might not fit into available storage at the same time. The ON OVERFLOW phrase is used to react to this situation, and to release the storage occupied by the other subprogram.
Running under a program that exhibits CMPR2 behavior, the ON OVERFLOW condition will be raised only for the "out of storage" errors, and the approach above is reasonable.
Running under NOCMPR2, the ON OVERFLOW condition might be raised for errors other than the "out of storage" errors, and therefore, the second call (inside the ON OVERFLOW phrase) might fail as well.