× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: CHGPF Question
  • From: John Dorn <jdorn@xxxxxxxxxx>
  • Date: Tue, 23 Sep 1997 11:17:47 -0400
  • Organization: I/NET Inc.

DAsmussen@AOL.COM wrote:
> I'll make the same challenge that I did with GOTO -- show me a SINGLE
> example under which it would be valid, and I'll admit my mistake 
> (haven't gotten one in almost a year on GOTO yet, but you're welcome
> to try with LVLCHK).

I definitely do not want to get the GOTO thread going again but I
would like to share how we use GOTOs.  We do much of our development
on the AS/400 using ILE C and we have created standards on how
functions are designed that include the extensive use of GOTOs, although
the GOTOs are "hidden" by the use of macros.

Example (pseudocode):

Begin Function/Subroutine

   Call/do something                   
   CHECK_EXCEPTION(if error,ERROR1);  (IF error occurred GOTO ERROR1)

   Call/do something else
   CHECK_EXCEPTION(if error,ERROR2);  (IF error occurred GOTO ERROR2)
   EXIT;  (GOTO EXIT)  /* Mainline processing completed successfully */

ERROR1:
   Handle error
   EXIT;

ERROR2:
   Handle error
   EXIT;

EXIT:
   Function clean up 
 
End Function/Subroutine

We believe the use of GOTOs in this structured manner results in code
that is well organized (e.g., separation of mainline and error logic,
one function exit point) and much easier to read (e.g., reduces number
nested IF/THEN/ELSES) and maintain.  

In the past I have had to maintain RPG programs that were loaded with
GOTOs that jumped all over the place- I would not wish that code on
anybody.  Coming from a computer science background I just cannot
understand how someone can write code like that.   But then again, I
look back at some of my old code and wonder what I was thinking.

By the way, I have only encountered two cases that I can recall that
absolutely required the use of GOTOs:
1)College program where we had to simulate recursion
2)CL (and any other language that does not have the minimal keywords/
  op codes needed to write structured code)

Structure is not a four letter word,

John Dorn
I/NET, Inc.
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.