Mark,
I remember teaching structured programming on the S/3. Since (at the time) I knew Cobol, I knew that RPG II did not have the "proper" structured op-codes, but I had no problem using GOTO's (as has been pointed out here before, EXSR, IF/ELSE, etc. all use GOTO under the covers) - as long as they were localized. I.e., no fair jumping outside of the function. Otherwise GOTO's were verboten. Even wrote an article on it for, what was it, System/3 World or something like that. And the mainline, as you suggested, was supposed to be kept to a single page.
Jerry C. Adams
IBM System i Programmer/Analyst
--
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S. Waterbury
Sent: Thursday, March 04, 2010 10:52 AM
To: RPG programming on the IBM i / System i
Subject: Re: OPEN in RPGIII
Hi, Jerry:
Thanks for those clarifications.
In the early 1980s, they were teaching RPG II on an IBM System/34 at St.
Petersburg Junior College in Clearwater, Florida, and the instructors
there had come up with some very clever ways to teach "structured
programming" using only what RPG II provided at that time. The technique
relied on heavy use of EXSR. So, for example, and IF-ELSE-END logic
block might look somethling like this:
FLDA COMP FLDB 010203
01 EXSR THEN01
0203 EXSR ELSE01
and so on. The statements to be executed in the "then" would be
contained in a BEGSR and ENDSR with the name "THEN01" (in this case),
and the statements for the "else" would be in another subroutine with
the name "ELSE01", and so on. Of course, you could also try to make up
more "meaningful" names instead of "THENnn" and "ELSEnn", within the
limits of six-character names... you get the idea...?
Also, a DO-WHILE it looked something like this:
WHILE1 TAG
FLDA COMP FLDB 01
01 EXSR WHL01
01 GOTO WHILE1
And a DO-UNTIL it looked something like this:
UNTIL1 TAG
EXSR UTL01
FLDA COMP FLDB 01
N01 GOTO UNTIL1
You get the idea... Also, if the number of statements to be executed in
the "body" of the loop was small, they might be included in-line, rather
than using an EXSR as shown above.
They also encouraged a very "modular" style of coding, where the
"main-line CALCs" were usually just a sequence of EXSRs, and all of the
actual logic was contained inside one or more subroutines.
Not too bad, considering the "state of the art" in System/34 RPG II in
the late '70s and early '80s ...
That's about all I can remember from those days.
Mark S. Waterbury
Jerry Adams wrote:
Mark,
There were no structured op-codes (IF, DO) on the S/34 - except through Schuette's (sic) RPG II 1/2.
They were added to the /36 when the Advanced/36 models came out (SSP 7?), but they were somewhat crippled. CAB was never part of IBM's RPG II compilers.
Jerry C. Adams
IBM System i Programmer/Analyst
--
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Mark S. Waterbury
Sent: Thursday, March 04, 2010 8:13 AM
To: RPG programming on the IBM i / System i
Subject: Re: OPEN in RPGIII
Hi, Terry:
IBM System/3 RPG II had only COMP, indicators, GOTO and TAG, and EXSR,
BEGSR and ENDSR (for "control flow").
With the IBM System/34, IBM added "structured programming" opcodes
(still calling it RPG II):
IF - ELSE - END
DOWxx - END, DOUxx - END, DO - END
CASxx
CALL and PARM were added with Systen/36 Release 6 (VASP).
I think CABxx was introduced with System/38 RPG III.
(Anyone else remember those details any better?)
HTH,
Mark S. Waterbury
> Terrence Enger wrote:
Hmm, this is a real memory test for me, but are you sure that RPG II had
the CABxx and CASxx opcodes? I only remember these from RPG III.
CVTRPGSRC, of course, does not claim to work for RPG II.
Cheers,
Terry.
As an Amazon Associate we earn from qualifying purchases.