Problem:
Working Storage of a subroutine is not re-initializing after a CANCEL is done in the calling program. Subsequent calls to the subroutine have the Working Storage items in the same state as after the end of the previous CALL.
Resolution:
This is caused by the use of the NODYNAM directive. Using this directive causes the CANCEL statements to be ignored.
Even if you don't explicitely use the NODYNAM directive, you might have a DIALECT directive that will set it for you. If you do use the DIALECT directive, simply add the DYNAM directive after DIALECT and it will take effect.