× 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: rob@dekko.com
>Date: Fri, 11 Jan 2002 11:24:29 -0500
>
>Yes it does matter if the file field is unreferenced.
>If I reference the individual file fields then the array elements will
also
>work.
>My argument is that just by defining an array over the fields with the
>pointer address should be enough.
>Or is there some compiler option to say just bring the fields into memory,
>such as a don't optimise?

Rob, specify DEBUG(*YES) in your H spec.  That will cause all I specs to
be moved to program fields even if the program fields aren't used (but
that might be have a bigger impact than you want if you have lots of
unused fields in your files).

Defining the array over the fields with a pointer address should indeed
be enough, as long as the fields are "officially" contiguous.  But they
are not officially contiguous unless they are in a data structure.

>From a later post:
>I've heard this before "You are also assuming that consecutive fields in a
>file are stored in consecutive memory location which is not always the
>case."  But I've seen no examples.

You shouldn't need an example of a case where the fields are not
contiguous.
The fact that it is not guaranteed should be enough to stop you from
assuming they will be contiguous.  Undefined behaviour can change at
any time, from release to release or even from PTF to PTF.  (Go and stand
in
the corner! :)

A trivial case where the fields won't be contiguous is where you
have explicitly coded them in separate data structures:

D ds1             ds
D   x
D   ary1
D   y
D ds2
D   z
D   ary2

The current RPG compiler generates field definitions in alphabetical
order, I think.  So having the fields out of alphabetical order would
probably be certain to put them out of storage order.  But the compiler
doesn't actually map fields to storage.  The component that does map
out the storage might decide to take ARY1 and stick it in some little
empty spot created by some boundary alignment thing, way far away from
ARY2.

Barbara Morris



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.