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



Question:

I have to pass an array of GL Accounts that are 36A each. The array is
DIM( 400 ).

I thought I was being efficient when I moved the Array into a VARYING
variable-sized field and I passed the Varying field.
I thought that since MOST of the time, I am passing a single GL Account,
I would be passing less data in a buffer.

But based on Kurt's reminder below, my field - - passing with CONST is
passing Relative - - I think I have gained nothing by moving my array
into a Varying-Sized Field. Since I am only passing the pointer, the
use of the varying field is for naught. And I should go ahead and pass
the entire Array of 14,400 bytes, since I am not passing the field, but
a pointer to the field.

In fact, am I being inefficient, since I have two memory locations
(array and varying field) defined when I really just need one (the
array)?
Is there any efficiency to be gained by this use of Varying in this
case? Other than knowing the number of Elements in the array is %Len()
/ 36 ?
Are there any other low-level buffers I have made more efficient now
that I reduced my parm's size?
Or should I just trash my code that does the call, and pass the whole
array (i.e. pass the pointer to the array) ?

(This is not a service Pgm, but a call to a second Pgm that has EXTPGM()
with prototypes.)

-John

Others have responded to say to not make the Data Structure based on a
pointer. I just thought I'd expand on that and
say that the DS parm is actually only going to pass a pointer under
the covers given your code sample. Specifying the
parameter keyword Value will pass the entire data structure, otherwise
if Value isn't specified (which means either Const
or neither Value nor Const are specified), then the parameter is
Passed by Reference (so it passes a pointer).
Kurt Anderson


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.