Re: pattern for an error



On Wed, 28 May 2008 02:31:57 -0700 (PDT), mario <mmc_vw1200@xxxxxxxxxxx> wrote:

hi everyone,
i have to redesign a peace of code with a lot of GOTOs
looks like that

start.
perform something
perform something_else
perform anything
perform anything_else
...
.

something.
do_something
if (x>10)
error occurs
go to error
end-if
do_something_else
if (y=z)
error occurs
go to error
end-if
.

error.
write error msg
.
ende.
exit program.


so as u maybe see in any paragraph there are exit conditions when the
program should stop and write error massage
my problem now: is there any style guide or pattern to make that in a
clean way WITHOUT goto because i have to transfair it into an acu code
without goto.
the only way i´m thinking is to give a intern retern key after any
paragraph but code would look very confusing right??

Change 'go to error' into 'perform error' (where error includes exit program), or write an
inline 'exit program returning 1234'. Every program should pass back a return code: 0 for
success, non-zero for error. You can do it by moving the value to 'return-code' or with
the returning clause.
.



Relevant Pages

  • pattern for an error
    ... exit program. ... so as u maybe see in any paragraph there are exit conditions when the ... clean way WITHOUT goto because i have to transfair it into an acu code ...
    (comp.lang.cobol)
  • Re: pattern for an error
    ... where you discover the problem and at the end of the error routine use STOP RUN ... Stay with EXIT PROGRAM if you want to return ... -> GOTO END ... layers get called often the hole thing gets VERY unclear and is full ...
    (comp.lang.cobol)
  • Re: Returning text from Userdefined Functions
    ... the paragraph that I named "End:" is in my original program ... I have also tried not to use the line "Goto Slutt" in my error handler ... Because the error handler is called from the UDF it is subject to the same ... aren't notified and simply get the VALUE error in the cell. ...
    (microsoft.public.excel.programming)
  • Re: Spaghetti code (was: Is it always possible to write a COBOL program using only 1 sentence per
    ... > the GOTO would be spaghetti-coding. ... was written in the spaghetti style of coding was to ask: ... I can infer what the performed paragraph does ... number that is within epsilon of the true positive square root (i.e. the ...
    (comp.lang.cobol)
  • Re: COBOL aint quite dead - yet !
    ... The point about goto is that there is nothing at all wrong with a goto ... For example the use of an exit paragraph signals ... loops - which was all about replacing a GOTO with something that did the ...
    (comp.lang.cobol)