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



Hi Everyone,

I've run into something that has me stumped, and I think it's because
there's something about using pointers that I don't understand.

In a nutshell:

I have a data file @MSI4 with fields defined as follows:

A            MSIQ01         3
A            MSIQ02         3
A            MSIQ03         3
A            MSIQ04         3
A            MSIQ05         3
A            MSIQ06         3
A            MSIQ07         3
A            MSIQ08         3
A            MSIQ09         3
A            MSIQ10         3
A            MSIQ11         3
A            MSIQ12         3

and I have a display file MSI410FM with fields defined as follows:

A            DSPQ01         3A  B 17 22
A            DSPQ02         3A  B 17 32
A            DSPQ03         3A  B 17 42
A            DSPQ04         3A  B 17 52
A            DSPQ05         3A  B 17 62
A            DSPQ06         3A  B 17 72

and in my program I have :
D               E DS                  ExtName(@MSI4 )
D  MQ             S                   Like(MSIQ01) Dim(12) Based(PMQ)

D  DQ             S                   Like(DSPQ01) Dim(6) Based(PDQ)
D  HQ             S                   Like(MSIQ01) Dim(12)
. . . .
C                   EVAL      PMQ    = %ADDR(MSIQ01)
C                   EVAL      PDQ    = %ADDR(DSPQ01)
. . . .
C                   DO        12            X
C                   EVAL      HQ(X)  = MQ(X)
C                   EndDo
C                   DO        6             X
C                   EVAL      DQ(X)  = HQ(X)
C                   EndDo

(Lots of stuff left out; among other things, I've got four other sets of
fields in the file that are treated the same way -- one 2,0, two 4,2, and
one 8A; they are all part of the DO loops and they all seem to work fine.)
The idea is that I have 12 values in the file, but I can only display 6 of
them at a time, so I use the arrays to swap groups of 6 in and out based
on user choices. This pointer trick seemed to be ideal for handling this!

When I start, the file has the following values:
MSIQ01 = 'AAA'
MSIQ02 = 'BBB'
MSIQ03 = 'CCC'
MSIQ04 = 'DDD'
MSIQ05 = 'EEE'
MSIQ06 = 'EEE'
and when I finish the DO loops, DQ(1) - DQ(6) have the correct values.
However, the display file fields have the following values:
DSPQ01 = 'AAA'
DSPQ02 = 'BBC'
DSPQ03 = 'CDD'
DSPQ04 = 'EEE'
DSPQ05 = 'FF '          <- 1 space
DSPQ06 = '   '          <- 3 spaces

I did a quick experiment and discovered that if change the display field
size from 3A to 4A, it seems to work. I also tried putting in an
externally-described data structure for the display file MSI410FM, but the
compile choked on the indicators.

Can anyone help me understand what is going wrong here and/or how to how
to fix it? Does it have something to do with 8-byte boundaries for pointer
addresses? Why does it only seem to affect the display file fields?

Thanks!


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



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.