× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I know that not many people are coding new interactive green-screen applications, but I still do occasionally. Many, many moons ago, a colleague and I created some shell source code programs, as I'm sure a lot of shops have done over the years (decades). For interactive programs, we came up with something similar to this to control the flow:

c eval #WrkMode = Initialize

c DOU #WrkMode = Exit
c #WrkMode caseq Initialize sWrkInz
c #WrkMode caseq Build sWrkBld
c #WrkMode caseq Display sWrkDsp
c #WrkMode caseq Functions sWrkFun
c #WrkMode caseq Process sWrkPrc
c ENDCS
c ENDDO

c eval *inLR = *on

It was simple and succinct, compact and easy to read - subroutines could be added or removed as needed. But it's old fixed-format OPM code.

Over the years, I've converted this logic to free-format using subprocedures, which has resulted in something akin to this:

#Mode = Initialize;
Select;
When #Mode = Initialize;
sInitialize();
When #Mode = Build;
sBuildSubfile();
When #Mode = Display;
sDisplay();
When #Mode = Functions;
SFunctions();
When #Mode = Process;
sProcess();
ENDSL;
Exit();

It's still the same logic and still works, but in my opinion has lost some of its 'elegance'. It's also still 'OPM' thinking. Also, I've always wondered about the performance - for example the Initialize routine typically only needs to be run once, but with this style the loop is constantly doing the check for #Mode = Initialize.

So I'm looking for opinions:

Is there a better way to code this in free-format, or a way to take more advantage of the sub-procedures?

What's your opinion of this style - should I just be using a DOU Key = F3 loop?

Everyone probably thinks their way is better but, really, is there a better way?


Thanks

Bob Cagle
IT Manager
Lynk, Inc.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.