Joel -

I'm not an expert, but I don't think you can add fields to an external DS.
I think you can solve your problem, though, by defining stand-alone fields
using pointers:

d extDS        e ds                            extname(EXTDS)

d extDSovr       s                     100a   %dim(elem) based(ptrXXX)    
           <== now stand-alone array

c                      Eval           ptrXXX=%addr(DSfield)

where DSfield is the first field in your externally-described format.

hth


RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> writes:
>I'm trying to overlay an external DS that gets populated by an SQL
>statement.  When I do NOT include the data, the DS is populated
>correctly: if I add the overlay, the DS is blank even though the SQL
>statement has no trouble finding the record.
>
><psuedo-code>
>
>// this way extDS gets populated
>d extDS        e ds                            extname(EXTDS)
>...
>c/exec SQL
>c+   Fetch next 
>c+    from myCursor 
>c+    into :extDS
>c/end-exec
>
>// this way extDS (and hence extDSovr) does NOT get populated
>// elem is the correct number of fields in EXTDS
>// All fields in EXTDS are defined the same: 100a
>d extDS        e ds                            extname(EXTDS)
>d extDSovr                             100a    overlay(extDS) %dim(elem)
>...
>c/exec SQL
>c+   Fetch next 
>c+    from myCursor 
>c+    into :extDS
>c/end-exec
>
></psuedo-code>
>
>Any idea why this is happening or even better how to fix it?
>
>Thanks!
>
>Joel
>http://www.rpgnext.com


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

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.