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





On Fri, 12 Sep 2003, Chevalier, Rick wrote:

>      c                   eval      US_PTR += %Size(fld)                       
>  Move to next field

This is incorrect code...   you have to advance the pointer by the
size of the entry as returned by the API, rather than the size of the
structure.   Otherwise, if IBM ever adds more fields to the structure,
your code will break.


>
> I have a hard time believing it would be slower and IMHO it more
> straightforward.
>

I disagree on both of these points.

User spaces are generally stored in auxiliary storage, whereas variables
are stored in main storage.  Granted, OS/400 will move frequently accessed
items from aux storage into RAM in order to make them faster, and it will
also move data from RAM into disk if you don't have enough RAM to handle
everything on the system.   So, the difference is where things start --
a user space will start on disk, and because of frequent access will be
promoted to RAM.   Variables start in RAM, and only get moved to disk if
you're running out of RAM.   Consequently, variables will be faster for
the first few accesses.

However, in this case, he still has to read the user space, so it may end
up making no difference, or making very little difference.   But, I would
still opt on the safe side.

Furthermore, saying that accessing a user space by pointer is more
"straightforward" is a strange statement to me.   You really think that
pointer math is easier for the average programmer to understand than an
array?

Or, is it just that I'm using new features of the language that's got you
thinking that it's not straightforward?  If I used a MODS instead, would
you like that better?

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.