|
Kevin, Here is the source from a tech tip that was published in Midrange Computing. I don't recall the issue. To use this you will need to pass the translation strings. You can wrap this procedure in another procedure that passes the upper and lower character sets. Also, you will have to remove the message handline or download the message toolkit from Midrange Computing's web site. There is also a newer version of the message toolkit if you send me an email. You would use this like: C eval field = xlt(field: 'abcd...': 'ABCD...') qprotosrc: ************************************************************************** * Xlt Translate characters of string. Characters of the * * input string that match an input translation character, * * are translated to the corresponding output translation * * character. * * Input: * * InpStr Input string to translate. * * InpXltChr Translate from character(s). * * OutXltChr To output character(s). * * Return: * * OutStr Output string * ************************************************************************** DXlt PR 32767A VARYING D PR_InpStr 32767A VARYING CONST D PR_InpXltChr 256A VARYING CONST D PR_OutXltChr 256A VARYING CONST qrpglesrc: ************************************************************************** * Module - Xlt * * By - David Morris * * Notes - Before creating this procedure download and create the * * message toolkit service program from Midrange Computing * * November 1998 which can be found at: * * http://www.midrangecomputing.com/mc/prog/98/ * * Compile - CRTRPGMOD MODULE(objlib/XLT) * * SRCFILE(srclib/QRPGLESRC) * * SRCMBR(XLT) * * DBGVIEW(*SOURCE) * ************************************************************************** /TITLE Xlt - Translate characters of string. ************************************************************************** * Xlt Translate characters of string. * ************************************************************************** H NOMAIN H OPTION(*SRCSTMT) /COPY QPROTOSRC,MsgTkt /COPY QPROTOSRC,Xlt PXlt B EXPORT DXlt PI LIKE(RtnStr) D InpStr 32767A CONST VARYING D InpChr 256A CONST VARYING D OutChr 256A CONST VARYING ************************ * Define return string * ************************ DRtnStr S 32767A VARYING C IF %LEN(InpChr) C <> %LEN(OutChr) C* Return errors using Message Toolkit procedure C* (See ILE Message Handling 11/98 MC) C CALLP SndMsg( C *OMIT: C 'Input translation character length ' + C %TRIML(%EDITC(%LEN(InpChr): '1')) + C 'not equal to output length ' + C %TRIML(%EDITC(%LEN(OutChr): '1')) + '.') C ELSE C EVAL %LEN(RtnStr) C = %Len(InpStr) C InpChr:OutChr XLATE InpStr RtnStr C ENDIF C* C RETURN RtnStr PXlt E David Morris >>> keblankenship@highlights-corp.com 12/18/00 02:11PM >>> I am looking for an easy way to convert an alpha field to all upper case characters. anyone have any suggestions? Kevin Blankenship Highlights For Children Business Systems Developer +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-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-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.