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



Thanks to all who replied.
This is what I wound up doing:

* QtyArr s like(TAW01) Dim(54) Based(ptQty)
*ptQty s *
D Weekly_Bkts E DS ExtName(OTA)
D QtyArr Overlay(Weekly_Bkts:29)
D like(TAW01) Dim(54)


and then I removed my pointer eval
ptQty = %addr(TAW01) ;

-gerald




On 12/6/2010 8:07 AM, Gqcy wrote:
Thank you Mark and Jon.
When I first stumbled across this I thought it may be too good to be true!

-gerald



On 12/4/2010 4:07 PM, Mark Murphy/STAR BASE Consulting Inc. wrote:
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


--





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.