|
Dan, If character 2048 is an apostrophe, you're telling it to start scanning at character 2050. You need to test nPos before your %scan to make sure it isn't larger than the length of InString. Matt -----Original Message----- From: Dan [mailto:dbcerpg@yahoo.com] Sent: Wednesday, January 29, 2003 3:06 PM To: rpg400-l@midrange.com Subject: What's the error? I am having a devil of a time debugging a what should be a simple thing: Eval nPos = %scan(OneQ : InString : nPos ) OneQ is defined as a single apostrophe: D OneQ C Const('''') The program blows up on this statement whenever the last non-blank character in the InString variable is an apostrophe, with the following error: <snip> P EnQuote B d EnQuote PI 4096A VARYING D InString 2048A VALUE VARYING D nPos S 5I 0 D OneQ C Const('''') D TwoQ C Const('''''') C Eval nPos = %scan(OneQ:InString) C Dow nPos > 0 C Eval InString = %replace(TwoQ: InString: nPos: 1) C Eval nPos = nPos + 2 C Eval nPos = %scan(OneQ : InString : nPos ) C enddo C Eval InString = OneQ + InString + OneQ C Return InString P E <snip>
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.