|
On a 7.2 machine I can use the new keyword CCSID(*CHAR:*UTF8),
defining my char variables with CCSID 1208.
It seems to me that %subst does not substring characters, but bytes.
I'm running some tests, and I obtain these results.
My job CCSID is 1144.
I assign the string '€' (euro sign) to my utf-8 variable CHAR10.
H DECEDIT(*JOBRUN) DATEDIT(*DMY/) DFTACTGRP(*NO) ACTGRP(*CALLER)
H OPTION(*NODEBUGIO)
H CCSID(*UCS2: 1200)
H CCSID(*CHAR:*UTF8)
*
D CHAR10 S 10
D RTCHA1 S 10
D RTCHA2 S 10
D RTCHA3 S 10
C EVAL CHAR10='€'
C EVAL CHAR20=TXT(1)
C EVAL RTCHA1=%SUBST(CHAR10:1:1)
<<SNIP>>
The euro sign hex is E282AC (3 bytes).
If I try to substring CHAR10 I obtain this:
C EVAL RTCHA1=%SUBST(CHAR10:1:1)
RTCHA1 = 'S■■■■■■■■■' hex 'E2202020 20202020 2020'
<<SNIP>>
So it seems that %subst does not substring characters, but bytes.
I'm doing something wrong or this is working as expected?
How can I substring CHAR10?
Thanks for any advice.
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.