Scott,

Duh...

An excellent analysis!! Thank you for solving this.

> you to get that MCH5003 error.   It's actually quite lucky that you got an
> error instead of simply damaging something that's important without any
> notification.

You can say that again. I got code that worked okay most of the time. I was
lucky to stumble upon the MCH.

> Like I said in a previous post in this thread -- whenever you work with
> fields that can vary in size, you MUST BE VERY CAREFUL not to overwrite
> anything beyond the space that's been given to you.

Yes, Sir!

:-)

Thanks again for sticking with the problem.

Regards,

Wim


----- Original Message ----- 
From: "Scott Klement" <klemscot@xxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Sent: Friday, February 27, 2004 12:58 AM
Subject: Re: Parameter question (long)


>
> Hi Wim,
>
> The reason you're having problems is the following line of code in your
> program:
>
>    P#QIFRVal = %str(W#QIFRVal: P#QIFRValLen);
>
> If you change it to look like this, the problem will go away:
>
>    %subst(P#QIFRVal: 1: P#QIFRValLen) = %str(W#QIFRVal: P#QIFRValLen);
>
> The problem with your original code is that it overwrites 2048 bytes of
> memory, no matter what the value of P#QIFRValLen is.
>
> If the value of P#QIFRValLen is 14, as in your example code, then the
> first 14 bytes of P#QIFRVal are being set to whatever data is returned
> from the GetQFKeyVal procedure.   The remaining 2034 bytes are being set
> to blanks!
>
> Like I said in a previous post in this thread -- whenever you work with
> fields that can vary in size, you MUST BE VERY CAREFUL not to overwrite
> anything beyond the space that's been given to you.
>
> In the example above, 2034 blanks are being written to memory that you do
> not own.  It's clobbering other data, possibly important data, and causing
> you to get that MCH5003 error.   It's actually quite lucky that you got an
> error instead of simply damaging something that's important without any
> notification.
>
> _______________________________________________
> This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
> To post a message email: MIDRANGE-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/midrange-l
> or email: MIDRANGE-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-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-2022 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.