| Richard 2004-11-18, 3:55 am |
| Joe Zitzelberger <joe_zitzelberger@nospam.com> wrote
> It looks like the BRN is a 'branch routine' opcode?
An unconditional BRaNch or GO TO.
> And exit point is some address inside the routine 'start' where you
> insert an branch that returns to the BRN + 1?
>
> Did you ever accidentally overlay part of the 'start' routine with a
> misplaced return branch?
> Cobol has had four major redesigns since that time...
'Redesign' ? I don't think so.
> Absolute file numbers -- like Fortrans devices 1-6 or Cs 0,1,2
> stdin/out/err remain as a convention only with plenty of ways to alter
> them to adjust to the modern computer.
Modern computers do use stdin/stdout/stderr.
>
> Have not other things been removed from the language? ALTER seems to be
> on its way out...
ALTER has not been removed.
>
> Perform is a GOTO with a guarenteed return to the PERFORM + 1 statement
> after the execution is complete. Just like a GOSUB in basic or a
> function/procedure invokation in one of the block languages.
>
> In all those cases, the CALLED routine decides when to invoke the return
> to PERFORM+1 -- only THRU allows the CALL to say "stop when you get
> here, even if the CALLEE isn't finished".
>
> With the exception of the THRU clause, PERFORM follows the semantics of
> a CALL.
No it doesn't. But the problem is not with the starting point, but
with the end. PERFORMs may be of SECTIONs or paragraphs with or
without THRU and the ranges can overlap.
For example there could be:
PERFORM A
PERFORM A THRU B
In the first case the end of A should do a 'return', in the second
case it should drop thru. Even more pathological may be:
PERFORM A THRU C
...
A. PERFORM B
...
B. ...
C. ...
And what if the first PERFORM was PERFORM A THRU B.
CALL and RETURN just don't work for these.
That is why on the 1900 they used a mechanism, which had previously
been developed for assembler programs, of having the PERFORM set up
the return branch at the exit point and then BRaNching to the start
point. Afterwards they would reset the exit point back to what it
was. Initially all exit points (ie every end of paragraph and section
was a NULop.
The 1900 compilers that I used would put the NULops in automatically
and would know the address to use for that, so the EXIT paragraph was
not needed, as it was with earlier ones. With assembler though this
style would require a label in order to get the address to access to
modify the code and a specific NULop instruction as a place holder for
the branch back.
AEXIT NULL
Becomes, in Cobol:
A-Exit. EXIT.
|