× 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.


  • Subject: Re: DOW vs DOU
  • From: rbbaird@xxxxxxxxxxx (Rick Baird)
  • Date: Fri, 30 May 1997 20:08:52 +0100
  • Organization: Premium Systems, Inc.

Charlie Massoglia wrote:

> The 1 DOWEQ 1 construct is not really the logic of the loop.  The logic of
> the loop is really continue the loop until you press F3 or F12 to exit.

True.  The reasons behind my technique isn't a more perfect loop, rather
it is to keep related functions near to each other and clarity of
intent.  This is a very simple example, but after adding 4 or 5 other
command keys, and maybe some other program specific logic, this
subroutine gets more complex, it becomes more confusing.

The point is that, without paging forward or back several screens to
check what exactly the do loop was conditioned on, I check a single
specific condition and I leave (get out) or iter (go back) or continue. 

My style is to break things down into as small and as simple tasks as
possible an stack them one after another, rather than muck up the works
with a lot of complicated compound conditional statements.  

> Instead of using *INKC and *INKL we normally define an INFDS and check the
> AID byte.

I've liked and wanted to use the aid byte for years, but for whatever
reason (laziness probably) I've just never done it.  - but even if I
did, I would have still coded *ink, in the example to keep from having
to explain them for the benefit of those who dont use it.

 
> C                  SELEC
> 
> C       $$FKEY     WHEQ  ##F03               (If F3 or F12 is
> C       $$FKEY     OREQ  ##F12               pressed, set loop exit)
> C                  MOVE 'Y'       #EXIT1
> 
> C       $$FKEY     WHEQ  ##F04
> C                  EXSR  @@INQ1            (prompt/lookup inquiry calls)
> 
> C                  OTHER
> C                  EXSR  @@EDT1            (input field editing)
> 
> C       $ERROR     IFNE  'Y'
> C                  EXSR  @@UPD1            (file update)
> C                  EXSR  @@INZ1
> C                  ENDIF
> 
> (Again, $ERROR IFEQ 'N' could also be used.)
> 
> C                  ENDSL
> 
> C                  ENDDO
> 
> C                  ENDSR

I've done it this way in the past, but changed to my way because I never
have to worry about initializing or flipping the value of a variable -
in my way, leave/iter/continue are my only choices.  
as for using the select stuctures, I sometimes find that when the logic
gets more complicated, I might have to split the groups into two with
some common code in the middle or something to that effect.  I've done
it both ways, but I've gravitated to using simple IFXX statements with
the leave or iter, because when I duplicate the program, it always works
with little changes.  But this is just my own habits.

I do wonder though, why the heavy use of special charactors?  I usually
use a single @ for any passed parms (in or out), and a single $ for any
program defined variables, but other than that, I think it makes the
program hard on the eyes. - same with subroutines - I like using the
F1DISP/F1INZ/F1EDIT/F1UPDT or S1DISP/S1INZ/S1LOAD/ S1READ/S1EDIT/S1UPDT
for subfile processing.

> and an ENDDO several pages later, we always reverse the subroutine name to
> form the ENDSR tag.  An @@xxxx ALWAYS represents a subroutine BEGSR and a
> xxxx@@ ALWAYS represents the end of the subroutine. Yes, the GOTO drives
> structured purists wild but an exit to the end of a routine is structured
> code and we ALWAYS code this the same way in every program.  This is the
> only time we use a GOTO and will do so until we get a LEAVE type op code to
> exit a subroutine.
 
> I anxiously await (look forward to?) the condemnations for using a GOTO.  Be
> nice - remember no flames!

I won't go there.  I wish they had a leavesr opcode too, but I still
hate gotos.
 
thanks for the critique, always nice to see how the other half lives.

regards,

rick
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the Midrange System Mailing List!  To submit a new message,   *
* send your mail to "MIDRANGE-L@midrange.com".  To unsubscribe from     *
* this list send email to MAJORDOMO@midrange.com and specify            *
* 'unsubscribe MIDRANGE-L' in the body of your message.  Questions      *
* should be directed to the list owner / operator: david@midrange.com   *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.