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



I am a girl ;) Chuck is correct in what I was asking. Sorry if I had confused anyone :)

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Booth Martin
Sent: Wednesday, October 02, 2013 7:22 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Scan and Replace

Now I am glad I asked. Thank you Chuck. I had totally misread the request, and then compounded the error by assuming a solution that was not useful. Good catch on your part Chuck. :)


On 10/2/2013 8:14 PM, CRPence wrote:
On 02 Oct 2013 15:47, Booth Martin wrote:
Now I am confused. Does he want to remove all blanks? Or just reduce
any and all blank strings to one blank, only?
Probably best to ask the Original Poster or refer back to the
Original Post than to inquire in response to my comments :-) But,
given the question was raised, I explain my thoughts...

The goal was stated in the OP as "trying to find the spaces ' '
and replace them with no spaces ''" whereby the former
apostrophe-delimited string was clearly two blanks\space, and the
latter was the apostrophe-delimited empty string. While the
two-blanks might seem to suggest that the intent is to replace any
occurrences of successive blanks to just one-blank, that is not
compatible with the empty-string as the replacement value, because any
two-blank sequences would get removed without leaving anything to know
that a single-blank should be reinserted at that position. Thus I
concluded as very probable, that the two-blanks was likely a typographical error.

Additionally, within the same post, was a specific example of an
input string and the desired output string [albeit non-delimited].
That seemed to clarify that the intent was to replace each space
character with the empty-string; again, that the two-blanks was a typo:
"... 'COPY EQUIPMNT, EQIPX' for example... into something like this:
'COPYEQUIPMNT,EQIPX' ..." // strings apostrophe-delimited by me.

The same /apparent/ effect of removing all blanks seemed implied
again, later in the OP, in the code snippet that summed up that OP.
Albeit improperly formed syntactically, a %REPLACE example showed a
single apostrophe-delimited blank\space character, with another
argument as the apostrophe-delimited empty-string. Ignoring the
obvious syntax issue, the implication ¿seemed to be? an intention to
replace a ' ' with a '':
SUBDTA=%REPLACE(' ':'') // RPG statement in code snippet of OP

The message I replied to had a similar coding, but using the
%XLATE [albeit poorly formed, as in a request that would effect no
change to the data] instead of the %REPLACE; i.e. again, one blank,
and the empty-string [as the alluded replacement character according
to the supporting text in the replied-to message]:
SUBDTA= %XLATE(' ':'':SUBDTA) // RPG stmt in msg I replied-to

Thus it seemed to me, that the most conspicuous intent implied [in
both the OP and the message to which I replied] was to replace all
spaces\blank characters with the empty-string, for which, given IBM i
7.1 is the OS being used, the following request apparently [I can not
test] should effect that:
SUBDTA=%ScanRpl(' ':'':SUBDTA); // remove blanks from SUBDTA


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
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-Ups:
Replies:

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.