|
>> please explain the difference between GOBACK and EXIT PROGRAM for me(and maybe a lot of others?) GOBACK was added in ANSI '85 (I think) as an answer to the age-old problem caused by the fact that EXIT PROGRAM is ignored when in the main program. It is just a no-op and cause the logic to drop-though to whatever is next in the code. Nasty and produces some very hard to debug situations. This causes problems in a multi-language environment where a generic routine may be called form COBOL as a sub program or from another language, in which case it would tend to become main. In many cases programs would be coded as EXIT PROGRAM followed by STOP RUN on the next line to avoid dropping through into unexpected logic. Alternatively in implementations that allowed non-COBOL programs to appear within the run unit (such as the OS/400 COBOL implementations) a "stub" program is often used in front of the non-COBOL programs to ensure that any subsequent COBOL programs are sub programs. This has the added benefit of increasing performance as the run unit is not constantly being torn down and then rebuilt. GOBACK was the "solution" since they couldn't change the definition of EXIT PROGRAM. GOBACK acts as an EXIT PROGRAM in a sub program and STOP RUN if it is in a main. Jon Paris Partner400
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.