|
JIM.BOSTWICK@xxxxxxx wrote: > > I am looking for some coding examples for converting CCSID 13488 to CCSID 37. > I am looking into using a password validation pgm that has to allow for > incoming parms in CCSID 13488.....Any help would be greatly appreciated. > TIA, Jim > > ! If you use a ucs-2 field (type C) for the 13488 data, then you can use the %CHAR builtin function to do the conversion to your job CCSID. If you need 37 and your job CCSID isn't 37, you'd need to use something like iconv() as suggested. (RPG doesn't support multiple ccsids for character data - it assumes all character (type A) data is in the job ccsid.) D ccsid13488 s 10c ccsid(13488) D charValue s 10a charValue = %ucs2(ccsid13488) If you're receiving the parameter as a character value, you could make the ucs-2 value based. If you use substring, you have to divide the length by two when using the ucs-2 field, since ucs-2 characters have two bytes each. D ccsid13488 s 10c ccsid(13488) D based(pCcsid13488) D charValue s 10a D len s 10i 0 pCcsid13488 = %addr(charparm) len = %len(charparm) / 2 charValue = %subst(ccsid13488 : 1 : len)
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.