Problem:
The program, calling a sub program multiple times, runs successfully with the return code=0 before stop run. However, the error level check in bat file returns 3.
Resolution:
You need to use the "returning" keyword on the goback, or stop run statement, to ensure the return-code is appropriately passed :
For example:
IF RETURN-CODE = 0
GOBACK RETURNING 0
or:
STOP RUN RETURNING RETURN-CODE