×
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.
Mike Wills wrote:
I am experiencing a weird error when debugging a subprocedure. The program
runs through properly then after it hits the return statement, it runs
again, and again, and again. I have not manually run it until it "pukes" but
when it finally returns data back to my calling app, I get bad data.
Calling statement:
tempChar = ParseEmailAddresses(cEmail); //receiver field defined
as 100A dim(327)
Called subprocedure which takes a semicolon delimited string of email
addresses and breaks them into an array.
P ParseEmailAddresses...
P B EXPORT
D ParseEmailAddresses...
D PI 32700A
D toParse 32767A CONST
Mike, you have defined your procedure as returning 32700A, and your
receiver field as 100A dim(327). I think you are intending for the
32700A returned value to be split up into the 327 100A elements, but
what actually happens is that the entire return value is assigned to
each element of the 100A array. So each element is getting the first 100
bytes of the 32700A return value.
One way to fix it would be to define your receiver field as a 32700 DS
with a 100A array dim(327) subfield.
The reason your procedure is getting called over and over:
When you code like this in RPG
array = nonarray;
the compiler generates code like this:
for i = 1 to number of elements in array;
array(i) = nonarray;
endfor;
The compiler evaluates the right-hand side of the expression for each
iteration of this loop, so your procedure gets called 327 times.
As an Amazon Associate we earn from qualifying purchases.
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.