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



Andrew,

I believe a MODS can be based therefore dynamic. However, no matter whether
I use a MODS or an ARRAY, I am not allocating the storage through the based
pointer.  If there are too rows returned, the FETCH fails. If too few, I
have unused elements.


Thanks,

Mark


Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
mwalter@hanoverwire.com
http://www.hanoverwire.com
717.637.3795 Ext.3040



                    "Andrew Lutz"
                    <alutz@pmigroup.c        To:     <rpg400-l@midrange.com>
                    om>                      cc:
                    Sent by:                 Subject:     re: multiRow Fetch
                    rpg400-l-admin@mi
                    drange.com


                    04/08/02 04:32 PM
                    Please respond to
                    rpg400-l






I think you misunderstood me.

Correct me if I am wrong:

Multi Occurrence Data Structures cannot be dynamic
Arrays can be dynamic

What I have done is create a static MODS, I just call the routine over and
over.  (i.e. fetch 200 rows into 200 MODS, repeat if necessary)

What I thought was that you had figured a way to use the dynamic array to
replace the MODS method

The goal is to come up with the equivalent of 'result set'






>>> MWalter@hanoverwire.com 04/08/02 01:17PM >>>

Andrew,

It's still not working. It is not allocating the size of the pointer. I'll
post the code.

What's happening here is that the occur value is out of range. There are
still only 10 occurrences of the MODS even though there are 13 records in
the file.


Thanks,

Mark


Mark Walter
Sr. Programmer/Analyst
Hanover Wire Cloth a div of CCX, Inc.
mwalter@hanoverwire.com
http://www.hanoverwire.com
717.637.3795 Ext.3040

Here is the procedure

     DgetCtryMastAll   PR              *
     D count                         10i 0

     Ddsdata         E DS                  extname(ctrymast) occurs(10)
     D                                     based(pDS)
     DpDS              S               *   INZ

     Dx                s              3  0
     DmemSize          S             10i 0

     pgetCtryMastAll   B                   Export
     DgetCtryMastAll   PI              *
     D count                         10i 0

     c                   eval      memsize = %size(dsData) * 10
     c                   alloc     memSize       pDS


     c/exec sql
     c+ SELECT COUNT(*) INTO :count
     c+ FROM ctrymast
     c/end-exec

     c                   eval      memSize = %size(dsData) * count
     c                   realloc   memSize       pDS

     c/exec sql
     c+ DECLARE c1  CURSOR FOR
     c+  SELECT *
     c+  FROM Ctrymast
     c/end-exec

     c/exec sql
     c+ OPEN c1
     c/end-exec

     c/exec sql
     c+ FETCH FROM c1 FOR :count ROWS
     c+  INTO :dsData
     c/end-exec

     c/exec sql
     c+ CLOSE c1
     c/end-exec

     c                   return    pDS
     P                 e


Here is the Main procedure

     fQsysprt   o    f  132        printer oflind(*inof)
     DgetCtryMastAll   PR              *
     D count                         10i 0

     DdsCtryMast     E ds                  extname(ctryMast) prefix(i_)
     D                                     OCCURS(10) BASED(ptr)
     dptr              S               *   INZ

     Dx                s              3  0
     dcount            S             10i 0

     c                   eval      ptr = getCtryMastAll(count)

     c                   for       x = 1 to count
     c     x             occur     dsCtryMast
     c                   except    detail
     c                   endfor

     c***                dealloc                 ptr

     c                   eval      *inlr = *on

     OQsysprt   E            detail      1
     o                       x                   +1
     O                       i_ct_code           +1
     O                       i_ct_name           +1


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


_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
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 ...


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.