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