|
This line is wrong: F1 = %replace('':F1:%scan(C1:F1):1); It is setting all 32766 characters of F1. This is a problem because F1 may not be that long, and therefore, it will be overwriting memory that it should not be. Also, the RETURN statement: Return F1; This is copying 32766 bytes from the start of F1 to make a return value. That's not good because you're reading from memory past the end of the F1 parameter if it's not the full size. Not only that, but since F1 is passed by reference, it really doesn't make much sense to use it as a return value. You've already got the result in the calling procedure... returning it makes another copy of it as well. If you are assigning that return value back to the same variable, you'll cause some nasty problems. So, here's what I'd do: 1) Change the F1 = %replace() line to be %subst(F1:1:InLen) = %replace(etc). 2) Remove the RETURN statement. 3) Remove the return value from your Prototype (PR) statement 4) Remove the return value from your Procedure Interface (PI) statement See if that works... On Mon, 25 Nov 2002, JJW wrote: > Here's the code that has the problem with the pointer not > set. > > H nomain > > > * > -------------------------------------------------------------------- > H debug(*YES) > > H option(*SRCSTMT) > > * > -------------------------------------------------------------------- > /COPY *libl/sanfords,elimpr > > * > -------------------------------------------------------------------- > * B E G I N P R O C E D U R E > > * > > > P prREMOVE B Export > > * > -------------------------------------------------------------------- > D prREMOVE PI 32766 Opdesc > > D F1 32766 Options(*varsize) > > D C1 1 Const > > * > -------------------------------------------------------------------- > D CEEDOD PR > D ParmNum 10I 0 Const > D 10I 0 > D 10I 0 > D 10I 0 > D 10I 0 > D 10I 0 > D 12A Options(*omit) > * ------------------------------------------------- > D DataType S 10I 0 Inz > D DescInfo1 S 10I 0 Inz > D DescInfo2 S 10I 0 Inz > D DescType S 10I 0 Inz > D InLen S 10I 0 Inz > * ------------------------------------------------- > > /free > > > CEEDOD(1:DescType:DataType:DescInfo1:DescInfo2:InLen:*omit); > > > If InLen <> *Zeros AND C1 <> *Blanks; > > > > Dow (%scan(C1:F1) > *Zeros) AND (%scan(C1:F1) <= > InLen); > F1 = %replace('':F1:%scan(C1:F1):1); > > endDO; > > > > endIF; > > > > Return F1; > > > > /end-free > > > > prREMOVE E >
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.