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



Paul Jackson wrote:

I have a DS array (myds) (below) that is aligned and also which I will
be assigning storage to dynamically. In RPG IV the %size function
indicates that each entry is 644 bytes long (also indicated on the
compile listing), but if I do an "attr myds" in debug is says the size
is 41984 which when divided by the number of elements (64) gives an
element size of 656 which matches a 16 byte aligned structure.

I am concerned that if I use the %size value when allocating storage
that I am not giving sufficient space to the structure which could
cause issues with corrupted memory. Should I be allocating 656 to
each element of myds or 644?


Paul, you can use this nasty expression to get the allocated size of each element. Define it as a named constant so you don't have to see this ugliness in your calculation.
%DIV(%SIZE(DS:*ALL):%ELEM(DS))

I personally hate it that %SIZE gives 644 instead of 656 for your aligned data structure.


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.