Dennis,

 

That one deserves emphasis - do not use GOTO to jump into a construct.

 

On the other hand, a LABEL xxx with a GOTO xxx that exists inside an
IF/ENDIF works fine. 

 

Emmitt Dove

Manager, DairyPak Business Systems

Evergreen Packaging, Inc.

[EMAIL PROTECTED]

[EMAIL PROTECTED]

(203) 643-8022

 

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Dennis
McGrath
Sent: Tuesday, January 22, 2008 3:03 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Two eyes are not good enough

 

If RSTYLE complains, you'd better code it different.

If it does not complain, you are more likely to be successful.

 

You do not want to exit a Switch/EndSw or a While/EndW with a goto

 

If statements are just simple flow control constructs. 

You can goto OUT of them all you want. 

I would try to avoid gotoing INTO an if/endif block just because it is poor
form and may cause you some logical headaches.

 

Dennis McGrath

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Stuart Cohen
Sent: Tuesday, January 22, 2008 1:42 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - RE: Two eyes are not good enough

 

Emmitt, Sami and Alastair:

I very much appreciate your comments regarding GOTO commands within SWITCH
blocks.  During the long weekend, I was pondering over your comments
regarding why GOTO commands could be a problem within SWITCH blocks,
especially since I have not had a problem with this situation.........yet.
Then it dawned on me!  The GOTO statement would skip over the BREAK and
ENDSW statements and can thus confuse the computer which is looking for
these statements to close the block.  It also dawned on me that IF blocks
have corresponding ENDIF statements to close them and (though I have never
put a GOTO command in one) WHILE loops have corresponding ENDWHILE commands
to close them.  Does this mean that a programmer should not put GOTO
statements within IF Blocks and WHILE loops?

Once again, thank you very much!

Stuart J. Cohen, Ph.D.
Major, Medical Service Corps
Research Specialist
Walter Reed Army Medical Center
National Disaster Medical System Federal Coordinating Center
Phone: 202-782-3636
Cell: 301-514-3975
Fax: 202-782-4360
E-mail: [EMAIL PROTECTED]

 

 

Emmitt Dove wrote: 

Stuart,

 

To pick up on Albert and Sami's observations about the GOTO from a switch
block, here is how I handle that:

 

SET VAR vlabel TEXT = 'somelabel'

SWITCH (.vwhatever)

  CASE 1

   { Some condition exists }

   SET VAR vlabel = 'thisotherlabel'

    BREAK

  CASE 2

    {a different condition exists}

    SET VAR vlabel = 'yetanotherlabel'

  DEFAULT

    BREAK

ENDSW

GOTO &vlabel

 

Emmitt Dove

Manager, DairyPak Business Systems

Blue Ridge Paper Products, Inc.

[EMAIL PROTECTED]

[EMAIL PROTECTED]

(203) 643-8022

 


Sami Aaron wrote: 

Stuart -

 

I see two possibilities:

 

 "IF variable = NULL  THEN" should be    "IF variable IS NULL THEN"

Within a SWITCH block, you should issue "BREAK" instead of using "GOTO
TheEnd".. The break will drop the programming call down to the next line
after the ENDSW line.

Sami

 

____________________________

Sami Aaron

Software Management Specialists

913-915-1971

[EMAIL PROTECTED]

 

 

 

Alastair Burr wrote: 

I may be completely wrong but I thought that GOTOs in SWITCH statements were
something to be avoided. Maybe it's that which is not working?

 

Regards,

Alastair.

 

 

Reply via email to