MainframeSupports
tip week 43/2014:

I received the following tip from a reader working for Handelsbanken in Sweden, where it has become a best practise. I must admit debugging tools are something I hardly ever use except CEDF in CICS. This is the explanation why this is my first tip on the subject after 15 years of writing. If I get into trouble I usually insert some DISPLAY statements and remove them again when the problem is solved.

The idea behind this tip is to use a common section or paragraph for termination of the program. Instead of having a lot of GOBACK statements in your program you replace these GOBACK statements by a PERFORM EXIT-WITH-GOBACK. The next step is how to design EXIT-WITH-GOBACK:

EXIT-WITH-GOBACK.
    GOBACK
    EXIT
    .

The point is then when you have an error situation in your program where you finish the error process by executing a PERFORM EXIT-WITH-GOBACK then you easily find out where it went wrong using a debugger. All you need is to set a breakpoint on the GOBACK statement in the above paragraph, execute the program and when execution reach your breakpoint you simply choose to skip the statement. Hereafter you return quite gracefully to the statement following the PERFORM EXIT-WITH-GOBACK that normally would have terminated execution of the program. That is what I call a smart feature.

Previous tip in english        Forrige danske tip        Tip list