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



> From: Scott Klement
> 
> Unless I'm missing something, you had a predefined maximum number of
> entries in your code sample.  You called it "MAX" and told me to set
it to
> a suitably high number.

Yeah. You're missing something.  No matter how many entries I set in
MAX, no storage is used, so I can set an arbitrarily high number (as in
a compiler limitation type of number) and not worry about it.  I don't
define the storage until I actually know how many entries I'm going to
need.

I use this technique to separate the definition of the number of entries
from the called API.  That way, multiple applications can use the same
API, but with different amounts of storage.  The maximum is set in the
application, not the API.  That way I don't have to have an obscene
amount of automatic storage in the API to handle any conceivable caller.


>  d Entries       e ds                  extname(myEntry)
>  d                                     based(pEntries)
>  d                                     occurs(MAX)

This works, but requires a %occurs, which makes most non-RPG programmers
cringe (heck, it makes many RPG programmers cringe).  Personal
preference: I avoid MODS.


> For that, you should eliminate arrays altogether (including the
"Entries"
> array from your sample code) and do it purely with pointer logic, like
I
> did in the original code samples I posted when I started this thread.

"Should"?  Why?  Mine works just fine, and I like the way it reads ("Set
pointer to the address of the nth element").  But if you find it
offensive, feel free to not use it <smile>. I was just providing an
alternate solution.

I have no interest in debating "best coding techniques".  To me, the
best coding technique is the one that I can read in two years and
understand, and I find my array method is very easy to read.  Your
mileage may vary.


> That logic was one of the samples that I posted.

Oh yeah, you didn't like the way it looked.   I forgot.  This sort of
code is actually one of the better reasons to use /free.

Joe


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.