This was never necessary. It was easy enough (and often done) to code a tag-label on the ENDSR op-code. That, of course, would not accommodate the example cited by the OP; i.e., passing control to a point *prior* to the EXSR op-code.
I agree with Barbara about the branching into a control structure (IF...ELSE...). But the most inane thing was to allow branching from Detail calcs into Total calcs. The code necessary to prevent your program from going into a perpetual loop would be horrendous. Who ever thought that was a good idea should be pilloried!
Even in S/3 RPGII, which didn't even have RPG36's crippled structured op-codes, it was easy enough to build structured code using GOTO/TAG, but those had to be within a finite section of the code. Since Dennis and I came from a S/3 background, we *assumed* that branching out of a subroutine was verboten; after all, it's only logical. My guess (and it's only that) is that when the S/38 RPG compiler was being written, allowing branching anywhere was accidentally allowed as no one would think this could be an improvement. And now it has become institutionalized (i.e., not subject to a DCR).
Jerry C. Adams
IBM System i Programmer/Analyst
--
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
My epitaph is inescapable. It will read, 'He sent a midget up to bat.' - Bill Veeck
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Tom Huff
Sent: Thursday, June 03, 2010 4:45 PM
To: 'RPG programming on the IBM i / System i'
Subject: RE: Something Wrong with the following Code ?
The reason that it was supported was that it was before the inclusion on the
leave statement.
Tom
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Barbara Morris
Sent: Thursday, June 03, 2010 4:05 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Something Wrong with the following Code ?
Dennis Lovelady wrote:
That is the way I understood it for years! Something must have changed
recently. (By "recently," I mean within the last twenty or so.) The code
compiles (to my similar surprise) on V5R3.
I thought GOTO from a subroutine to detail calcs had always been
supported for all RPG versions, but I just tried the older compilers and
I found out that it's not supported for RPG II (RPG36). It is supported
for RPG IV and RPG III (both RPG38 and RPG). I have no idea why anyone
thought it was a good idea to support branching like that.
But even RPG36 supports branching into a structured group like an IF or
a DO. Somehow that seems even worse than branching from a subroutine
into detail calc.
As an Amazon Associate we earn from qualifying purchases.