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



Not sure what I said that is not true.

sjl has this:
dsfileX ds likerec( Irecx : *Output )

That means that sfileX is a qualified data structure. So, your approach of
redefine those fields in a different DS wouldn't work for him. He must inz
the pArray as %addr(sfileX.allowance1), which require all those allowance
fields to be contiguous.

Now, if he did not use likerec and do below instead, then your approach of
redefine those fields in a different DS won't pass compiler at all.
dsfileX e ds extname(IRECF)
which is what I meant by the problem with redefine approach is that you have
restricted other from being able to define the entire file DS in the
program.


"Mark Murphy/STAR BASE Consulting Inc." <mmurphy@xxxxxxxxxxxxxxx> wrote in
message news:mailman.33798.1299876332.2702.rpg400-l@xxxxxxxxxxxx...
Not true. In fact you have to put the fields in a DS or you can't be
assured that they will be contiguous.

If you don't read your records into a record DS, you can do this: (the
advantage being that you don't have to worry about someone changing the
sequence of the fields in the file)

D ds
D Allowance1 5p 2
D Allowance2 5p 2
D Allowance3 5p 2
D Allowance4 5p 2
D Allowance5 5p 2

D AllowArray s Dim(5) Based(pArray) Like(Allowance1)
D pArray s * Inz(%addr(Allowance1))

If you use a DS to read into, you can adjust the Inz on your pointer to
point to the appropriate field in your record DS, and you then don't need
the extra unnamed DS.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx

-----rpg400-l-bounces@xxxxxxxxxxxx wrote: -----
To: rpg400-l@xxxxxxxxxxxx
From: "hockchai Lim"
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Date: 03/11/2011 03:16PM
Subject: Re: Overlaying fields within a data structure with an array

Yes, that is what Jerry suggested to do. Just one problem with this
approach: you can no longer define the file ds on that program. So, if some
how some one needs to define the entire file structure as DS in that
program, then he is out of luck.





"James Lampert" <jamesl@xxxxxxxxxxxxxxxxx> wrote in message
news:mailman.33786.1299873838.2702.rpg400-l@xxxxxxxxxxxx...
Lim Hock-Chai wrote:
If you can guarantee that no one will ever change the file that will
make them become non contiguous:

Actually, if you're doing traditional RPG scatter-gather I/O, then the
relationship between the fields in the file shouldn't make any difference
if you redefine the fields to make them contiguous in a DS.

--
JHHL



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.