Re: CCSID - RPG issues
Barbara Morris <[email protected]> Mon, 2 Mar 2026 19:58:17 -0500
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Organization | IBM |
| Message-ID | <[email protected]> |
On 2026-03-01 3:46 a.m., Gad Miron wrote:
> ...
>> EVAL ds_NMMLIMP.ITEMNAME :x
> 00000 0014C380 206C6120 66696E20 6465206C - ..C .%/.öù>.ôõ.%
> ...
>
> Target value after assignment
>
> ds_NMWRKR.ITEMNAME8 = %subst(ds_NMMLIMP.ITEMNAME :1 : 128 : *NATURAL) ;
>
>> EVAL ds_NMWRKR.ITEMNAME8 :x
>
> 00000 00C29D43 1AC28025 2FC280D7 A5D7A4C2 - .B,â.B ..B PvPuB
> 00010 803CD7A9 D7A6C280 251B437A C2A0437A - .PzPwB ..â:Bµâ:
> 00020 C280C280 C280C280 C280C280 C280C280 - B B B B B B B B
> ...
> 00030 C280C280 C280C280 C280C280 C280C280 - B B B B B B B B
>
>
I can't guess why it is not getting an exception for the %SUBST with a
length of 128. The first 2 bytes of ds_NMWRKR.ITEMNAME8 are x'0014'
which means the current length is 20. Any length for %SUBST greater than
20 should fail with RNX0100.
What happens if you just assign ds_NMMLIMP.ITEMNAME ds_NMWRKR.ITEMNAME8
without %SUBST?
If you don't have CHARCOUNT(*NATURAL) in your control options, you need
to use the /CHARCOUNT directive to get the data truncated correctly if
the right-hand-size of the assignment is longer than the left-hand-size.
/charcount NATURAL
ds_NMWRKR.ITEMNAME8 = ds_NMMLIMP.ITEMNAME;
/charcount STDCHARSIZE
--
Barbara
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.
Please contact [email protected] for any subscription related questions.