|
Thank you all for your input. Some of the replies I knew about and some of them are pleasant surprises! Regards, Tracy L. Ball Total Response, Inc. Sr. Programmer/Analyst (317) 781-4600 ext. 3107 -----Original Message----- From: Bob Cozzi [mailto:cozzi@rpgiv.com] Sent: Tuesday, January 14, 2003 7:52 PM To: 'RPG programming on the AS400 / iSeries' Subject: RE: Removing punctuation (not using arrays) Tracy, If you have the RPG ToolKit for OS/400 you can do it in two lines of code. If you don't you can get the FindReplace procedure, out of my article on this topic at http://www.mcpressonline.com/mc?1@46.DRG8acAs5B1.104752@.6ae52ffe If you don't have the toolkit or the FindReplace procedure, you can still do what you want in just 4 lines of code: Here's some example D specs for the data... D input S 30A Inz('RABBIT PACK, 6PC. WINE TOOLKIT') D nPos S 10I 0 First get rid of the garbage and replace them with blanks. C ',.':' ' xlate input input Now get rid of the duplicate blanks.. C eval input = FindReplace(' ':' ':Input) In otherwords: C ',.':' ' xlate input input C eval input = FindReplace(' ':' ':Input) If you need to do it with raw RPG IV, its almost as easy. Just replace the FindReplace line with the following: C eval nPos = %scan(' ':Input:nPos) C dow nPos > 0 C eval input = %Replace(' ':Input:nPos:2) C eval nPos = %scan(' ':Input:nPos) C enddo Bob Cozzi _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo.cgi/rpg400-l or email: RPG400-L-request@midrange.com 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 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.