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



he said 3 fields per month, that would be 36.

Anyway, if you don't have the fields defined in a data structure, there is no telling how they are stored in memory. RPG does not necessarily put them contiguously. If you put the record into a DS, then you can do the trick with the pointer, because the DS is stored as it is defined.

Mark Murphy
STAR BASE Consulting, Inc.
mmurphy@xxxxxxxxxxxxxxx

-----rpg400-l-bounces@xxxxxxxxxxxx wrote: -----
To: "RPG programming on the IBM i / System i" <rpg400-l@xxxxxxxxxxxx>
From: Alan Campin
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
Date: 12/03/2010 06:33PM
Subject: Re: pointer to fields in file, mapped to array

How could it. You said you only had 3 fields per record, not 36. You are
just looking at other memory past the 3 fields in your records.

On Fri, Dec 3, 2010 at 3:23 PM, Gqcy <gmufasa01@xxxxxxxxx> wrote:

We have the following:
a file contains 54 buckets (packed 9,0) (one for each accounting week of
year)
to easily get these into an array I make:

an array:   QtyArr  s   like(TAW01) Dim(54)  Based(ptQty)
a pointer:  ptQty   s  *

I read a record,
then I set the pointer to the first field in the record:

 ptQty =  %addr(TAW01)  ;

I can work with QtyArr(x) fine...


however I tried to copy this logic to another program (different file),
instead of weekly buckets (packed 7,2) , I have 3 buckets per month...
and the array winds up with garbage...

array:  QtyArr  s    like(VRJAN) dim(36) Based(prQty)
pointer: ptQty  s   *

read a record
then:
  ptQty =  %addr(VRJAN)  ;

My array has garbage, which when I dump, in the later elements has the
names of different procedures in our binding directory, so either the
pointer is not correct, or the input record isn't all there???

Any Ideas to help debug this?

-gerald


--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.