Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
In article <n_PCe.121287$HI.53338@edtnps84>,
"Oliver Wong" <owong@castortech.com> wrote:
>     The adding of switches is mainly because this is pretty much the
> technique used by all GOTO-eliminating algorithms I've seen discussed in t
he
> literature and papers I've read on this topic. If there's a way to perform
> GOTO removal without adding new switches, I'd very much like to know about
> it because generating meaningful names for switches is rather difficult
> (these names WILL probably eventually be seen by some human, at least in t
he
> form of the outline of the program generated at the end, if not directly i
n
> the COBOL source code itself).
>
>     Whether or not there will be a "switch eliminating phase" is yet to be
> seen; it's much too early at this point to tell whether it will be
> nescessary, feasible, or even desirable. Right now, when confronted with
> "lots of switches" versus "lots of GOTOs", my requirements state that "lot
s
> of switches" is the lesser of two evils.
>
>     - Oliver

In many (not all) cases, you can use knowledge of idiomatic Cobol to
remove the need for switches.  Consider the common "go to exit":

1234-Some-Para.

.. some code ...

If condition
go to 1234-some-para-exit.

.. lots of code ...

1234-Some-Para-Exit.
exit.

This can always be rewritten as:

1234-Some-Para.

.. some code ...

If NOT (condition)
.. lots of code ...
END-IF

1234-Some-Para-Exit.
exit.

I have a hunch that you can do this without switches EXCEPT for the case
where a go to jumps over a paragraph boundary (E.G in a long perform
thru).

Report this thread to moderator Post Follow-up to this message
Old Post
Joe Zitzelberger
07-26-05 03:02 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 03:08 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.