GO TO

Most authorities urge us to minimize the use of GO TO, if not completely eliminate it. However, many COBOL programmers still use GO TO routinely. It is not unusual to find over a hundred GO TOs in a single program.

Read comp.lang.cobol for a few weeks and you can sample an endless debate. If your mind is made up and your habits are fixed, then nothing I can put on these pages is likely to sway you. But if you're still young and impressionable, or if you're spoiling for a fight, then consider my summaries of the issues.

In favor of GO TO

Against GO TO

When GO TO might be okay

Conclusions

As you may have guessed, I don't like GO TO. In my entire COBOL career I have never coded a GO TO. I've never even felt tempted to code one. That's how unnecessary they are.

(Actually there are two exceptions. I used to code GO TO in old CICS programs, because the CICS translator forced me to. Also, as a temporary measure, I sometimes code a GO TO in the course of getting rid of somebody else's GO TO's.)

If it were up to me to define shop standards, I'm not sure I would try to impose my tastes on everyone. At a minimum, though, my standards would say the following:


[home]COBOL Home [style forum]COBOL Style Forum