|
On Thursday, April 23, 1998 9:21 AM, Scott Swaim [SMTP:scott71@hpnc.com] wrote: > I am sorry for repeating this queston. I have already asked and > I got answers back but my E-mail program crashed and I lost all of > my saved mail. > > I need to find a routine that will take a 30 char string and change > it to uppercase as well as remove all punctuation. This will be > used to create a Key field of my item numbers. > > Example: > > Original: Gip 3.18-1.59 Ic656 > New : GIP318159IC656 > Scott, Here's one bit I saved from Bruce Vining. I'd always used XLATE, but I like his method better... F* Remove punctuation from a string and convert to F* upper case F* Upper case routine courtesy of Bruce Vining and Midrange-L F* IREQCTL DS I I 1 B 1 40TYPE I I 0 B 5 80CCSID I I 0 B 9 120CASE I 13 22 RESERV IMISC DS I I 19 B 1 40LENGTH I I 0 B 5 80BYTPRV I I 'Gip 3.18-1.59 Ic656' 9 33 DATAIN C *LIKE DEFN DATAOT FINAL Final result C* Convert to upper case C MOVE *LOVAL RESERV C CALL 'QLGCNVCS' C PARM REQCTL C PARM DATAIN C PARM DATAOT 25 C PARM LENGTH C PARM BYTPRV C* Remove punctuation C 1 DO LENGTH S 50 Point to src C 1 SUBSTDATAOT:S CHAR 1 Test charact C CHAR IFNE ' ' Punctuation C CHAR ANDNE'.' Punctuation C CHAR ANDNE'-' Punctuation C CAT CHAR:0 FINAL C ENDIF C ENDDO Point to src C* Show results C DATAIN DSPLY C DATAOT DSPLY C FINAL DSPLY C* Bye bye C MOVE '1' *INLR C RETRN >Alternatively you could use the RPG XLATE opcode to perform uppercasing, >but using the API provides valid uppercasing in all national languages >supported by the AS/400 (the CCSID of 0 in REQCTL) without you having >to be concerned with the language currently in use. > >Bruce Vining Buck Calabro Commsoft, Albany, NY mailto:mcalabro@commsoft.net +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.