Good point Glenn,

Any programming language that supports constructs which allow the
development of loops and subroutines that do not need GOTO's can be used to
create structured programs.  Another hallmark of structured programs is the
usage of text labels instead of numeric.
So, GOSUB DETERMINE.PREVIOUS.STATUS
can be used instead of GOSUB 17250...

Keeping logical constructs separate from 'doing stuff' is another good
practice, as is parsing all variables after the READ, having only one main
print routine (if printing), keeping subroutines from getting too big, not
going down too many levels in subroutines, the list goes on and on.  I have
been told that my basic programs look more like structured COBOL programs
than most basic programs.  And it's pretty true.

I agree that
OPEN '', ITEM.MASTER TO 'ITEM.MASTER' ELSE GOTO ABORT.ROUTINE
is allowable!  And remember, it's not GOTO's that kill, it's the person
pulling the trigger!!!  ;-)  (Or would that be the person hitting the return
key?!!?)

This is an example from one of my programs that is used to create the demand
file prior to sending the data to a 3rd party forecasting system "Demand
Solutions".  As you can see, it is quite easy to create structured code in
BASIC!

MAIN.SETUP.SECTION:*
  GOSUB OPEN.AND.INIT
  GOSUB SELECT.DEMAND.MAPS
  IF NOT(ERROR) THEN
    GOSUB MAIN.PROCESSING.LOOP
  END
  GOSUB FINISH.UP
END.MAIN.SETUP.SECTION:*
STOP
MAIN.PROCESSING.LOOP:*
  LOOP
    READNEXT TM.ID FROM 1 ELSE EXIT
    GOSUB READ.DEMAND.MAP
    IF ERROR THEN CONTINUE
    GOSUB PREPROCESS.PURGE
    IF ERROR THEN CONTINUE
    IF (FILE.SOURCE = 1 OR FILE.SOURCE = 3) THEN
      *Process SA file for file opts 1 and 3
      FILE.HANDLE = SA
      FILE.SELECT = 'SA'
      GOSUB SELECT.SA
      IF ERROR THEN CONTINUE
      GOSUB PROCESS.SA
    END
    IF (FILE.SOURCE = 2 OR FILE.SOURCE = 3) THEN
      *Process SA.HIST file for file opts 2 and 3
      FILE.HANDLE = SA.HIST
      FILE.SELECT = 'SA.HIST'
      GOSUB SELECT.SA
      IF ERROR THEN CONTINUE
      GOSUB PROCESS.SA
    END
    MSG=''
    GOSUB OUTPUT.LINE
    MSG='End of Listing for Demand Map ':MAP.NAME:', ':DESC
    GOSUB OUTPUT.LINE
  REPEAT
RETURN

Allen E. Elwood
Senior Programmer Analyst
Curnayn and Associates
Direct (818) 361-5251
Fax    (818) 361-5251
Cell    (818) 800-5595
Home (818) 361-7217

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Glenn Herbert
Sent: Thursday, June 17, 2004 12:01 PM
To: [EMAIL PROTECTED]
Subject: RE: [U2] [UV] WHILE READNEXT id DO


Is BASIC structured? :-p

If your answer is yes, then the GOTO should probably not be allowed (except
in rare cases).

If your answer is no, then GOTO away!! (caveat: if not abused!)

As Yoda says:  GOTO is the evil not; incorrect the usage is!

At 02:46 PM 6/17/2004, you wrote:
>You realize this does not conform to the ANSI structured programming
>principles?  I have a version dated 1982 and goto's are not allowed...
>
>Or was this just a joke?  In which case you certainly got me!  :-)
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of Simon Lewington
>Sent: Thursday, June 17, 2004 11:02 AM
>To: [EMAIL PROTECTED]
>Subject: Re: [U2] [UV] WHILE READNEXT id DO
>
>
><[EMAIL PROTECTED]> ...
> > LOOP
> > code
> > WHILE READNEXT id DO
> > more code
> > REPEAT
>
>I prefer:
>
>100
>[code]
>GOTO 300
>200
>[more code]
>GOTO 100
>300
>READNEXT ID THEN GOTO 200
>-------
>u2-users mailing list
>[EMAIL PROTECTED]
>To unsubscribe please visit http://listserver.u2ug.org/
>-------
>u2-users mailing list
>[EMAIL PROTECTED]
>To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/
-------
u2-users mailing list
[EMAIL PROTECTED]
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to