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


  • Subject: MODS in subprocedures
  • From: "Phil" <sublime78ska@xxxxxxxxx>
  • Date: Tue, 8 May 2001 17:27:15 -0400
  • Importance: Normal

I sometimes (but not every time) have this problem.

I am returning a pointer to a MODS in a sub procedure.  Sometimes the data
is valid - what I expect - and sometimes the data is garbage.

Here's a bit of my code (they are SQLRPGLE members)

H nomain
 *------------------
D getResources    pr              *
D  pr_rsctyp                     1    value
D  pr_key                        9  0
D  pr_rows                       5  0
 *------------------
P getResources    b                   export
D getResources    pi              *
D  rscType                       1    value
D  key                           9  0
D  rows                          5  0
 *------------------
D resourceDS      ds                  occurs(dsSize) based(p_rscDS)
D  resource               1     10
D p_rscDS         s               *   inz(%addr(#p_rscDS))
D #p_rscDS        s            100

C                   clear     *all          resourceDS
C** build the data structure here **
C                   return    p_rscDS

This is a snip from the calling subprocedure:
D getResources    pr              *
D  pr_rsctyp                     1    value
D  pr_key                        9  0
D  pr_rows                       5  0
D p_rscDS         s               *

C                   eval      p_rscDS = getResources('T':key:rows)
C
C                   for       i = 1 by 1 to rows
C     i             occur     resourceDS
C                   endfor

The address for p_rscDS is the same.  But the value contains garbage data.

Can anyone see what am I doing wrong here?

Thanks for your help,

Phil


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.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.