×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Hi Barbara,

If you do get the opportunity to update that doc, could you please post as
I am most interested.

Thanks
Don

 

Don Brown

Senior Consultant
 
[1]OneTeam IT Pty Ltd
P: 1300 088 400

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Barbara
Morris
Sent: Wednesday, 25 February 2026 12:29 AM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: CCSID - RPG issues

On 2026-02-24 8:56 a.m., Gad Miron wrote:
> ...
> // take first 128 chars of Item Description
> ds_NMWRKR.ITEMNAME8 = %subst(ds_NMMLIMP2.ITEMNAME :1 : 128) ;
>
> // Update map file - target
> update NMWRKR ds_NMWRKR ;
>
> C eval *INLR = *ON
>
> The update works but the value placed in ITEMNAME8 is erroneous ...
In debug, does ds_NMMLIMP2.ITEMNAME look correct before the %subst? Does
it have UTF8 data? (look at the hex value of the field in the debugger)

Does ds_NMWRKR.ITEMNAME8 look correct after the %subst?

Is it always incorrect? Or does the problem only happen with some values?

Using %subst with UTF8 data has the potential to only pick up the first
byte of a 2-byte character unless you are using the new CHARCOUNT NATURAL
support.

[2]https://www.ibm.com/docs/en/i/7.5.0?topic=functions-subst-get-substring

[3]https://www.ibm.com/docs/en/i/7.5.0?topic=cdt-processing-string-data-by-natural-size-each-character

(I should update that pdf document to talk about the CHARCOUNT support
that was added in 7.4 and 7.5 with PTFs.)

--
Barbara

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit: [4]https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
[5]https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

--
Message protected by MailGuard: e-mail anti-virus, anti-spam and content
filtering.
[6]https://www.mailguard.com.au

References

Visible links
1. https://www.oneteamit.com.au/
2. https://www.ibm.com/docs/en/i/7.5.0?topic=functions-subst-get-substring
3. https://www.ibm.com/docs/en/i/7.5.0?topic=cdt-processing-string-data-by-natural-size-each-character
4. https://lists.midrange.com/mailman/listinfo/rpg400-l
5. https://archive.midrange.com/rpg400-l.
6. https://www.mailguard.com.au/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 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.