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



You're right, and what a sneaky way to find a use for the index.

But wouldn't the MCH error only appear if I try to use the fields in the
based data structure after the last looping?  After all, seems to be
working.  Or would the error occur if I exceed the initial size of the user
space as created by QUSCRTUS?  Or would the error occur if I exceed the
size of the user space as changed by the list api which output's data into
it?

Rob Berendt

==================
A smart person learns from their mistakes,
but a wise person learns from OTHER peoples mistakes.



                    bmorris@ca.ibm.co
                    m                       To:     rpg400-l@midrange.com
                    Sent by:                cc:
                    rpg400-l-admin@mi       Fax to:
                    drange.com              Subject:     RE: Free format DO, or 
make index optional


                    10/03/2001 03:09
                    PM
                    Please respond to
                    rpg400-l







>From: rob@dekko.com
>Date: Wed, 3 Oct 2001 14:35:07 -0500
>
>Ok, I use List API's.  In the generic header section it says how many list
>entries there are, GHListNbr.  What I want to do is:
>
>/free
>       // Initialize our offset to the offset of the list data.
>       pJobl0100=pGH0100 + GHListOff;
>       For 1 to GHListNbr;
>        cmd='SNDBRKMSG MSG(' + Apostrophe + %Trim(BrkMsg) + Apostrophe +
>            ') TOMSGQ(' + %trim(JLJobNam) + ')';
>        qcmdexc(cmd:%len(%trim(cmd)));
>        pJobL0100=pJobL0100 + GHListMbrSz;
>       EndFor;

Rob, processing the list this way will work 999 out of 1000 times, but
on the thousandth time, you'll get MCH0601 (pointer offset) on the
final iteration of your loop.  You're incrementing the pointer one
too many times.

The best way to position the pointer is to use the loop control
variable :) at the top of the loop code rather than the bottom.

  pGH0100List = pGH0100 + GHListOff;
  for listEntry = 1 to GHListNbr;
    pJobL0100 = pGH0100List + (listEntry - 1) * GHListMbrSz;
    ...
  endfor;

Barbara Morris

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