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



I'm sure it's me, but I seem to be missing something big here. I recently
had a need to define arrays over a large record format, to simplify screen
handling (I wanted to set up my own "windowing" by swapping various
segments of the arrays in and out of smaller arrays on the screen). I was
able to do this using the following:

 * data structure for @MSI4
D               E DS                  ExtName(@MSI4 )                 
. . .
 * arrays for @MSI4 fields 
D  MP             S                   Like(MSIP01) Dim(12) Based(PMP) 
D  MX             S                   Like(MSIX01) Dim(12) Based(PMX) 
. . .
* set pointer values
C                   EVAL      PMP    = %ADDR(MSIP01)
C                   EVAL      PMX    = %ADDR(MSIX01)

where @MSI4 is the file name, MSIP01 and MSIX01 are the fields in the
record format where I want the arrays to begin, and MP and MX are just
used in the program for the arrays.

In the program I simply do my CHAINs and READs into the record format --
since the DS has been defined, I believe (?) the fields are contiguous in
memory (I think I got that tip from this list, and in testing everything
seemed to work okay -- it's been in production now for several months with
no complaints). 

Am I wrong about the fields being contiguous? Is it just dumb luck that
this seems to be working? And if I'm not wrong, what would I gain from
using LIKEREC?

RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> writes:
>If you would have asked me a few months ago if there was any use for 
>chaining into a data structure I would have thought you nuts.  However, 
>for ensuring that the fields use contiguous memory, and for overlaying,
>it 
>has proven quite useful.
>
>Rob Berendt


Mike Naughton
Senior Programmer/Analyst
Judd Wire, Inc.
124 Turnpike Road
Turners Falls, MA  01376
413-863-4357 x444
mnaughton@xxxxxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.