CCSID - RPG issues

Gad Miron <[email protected]> Tue, 24 Feb 2026 15:56:01 +0200
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <CAFj_=c0oBPMVuvKrin4F7yK+6R695UGYFErMcmqKCStx+pS0pw@mail.gmail.com>
Hello sages

I would greatly appreciate advice regarding the following CCSID issus:

We have lately added a 128 long, CCID(1208) description field to an
existing CCID(424) "mapping file" that maps external SKUs to our SKUs.
This file comprises mainly of:
EXTID        - External entity ID
EXTSKU    - External SKU
EXTDESC - External Description
INTSKU     - Internal (Our) SKU
and the new
ITEMNAME8 - External description 1208

now,
I need to update the new EXTDESC1208 field using descriptions retrieved from
another file that has a CCID(1208) description field.

I have managed to do it with SQL but I would very much like to
do it in the original RPG program that populates this map-file.

after consulting the enlightening doc by Barabara morris

https://www.ibm.com/support/pages/system/files/inline-files/working_with_unicode_in_rpg.pdf
I came up with a skeleton semi-hard-coded RPG program that should be capable
of updating one specific record, BUT FAILS.

Here comes (forgive the mixed free/fixed format):

H DATEDIT(*YMD)  ALWNULL(*USRCTL) CVTOPT(*VARCHAR : *VARGRAPHIC)

F* the source file to retrieve the description from
FNMMLIMPF2 if   e           k DISK    EXTDESC('URPS/NMMLIMPF')
F                                                       EXTFILE(*EXTDESC)
F                                                       DATA(*NOCVT)
F
 RENAME(NMMLIMPR:NMMLIMPR2)

F* The map file to be updated - target
FNMWRKF    uf   e           k DISK    DATA(*NOCVT)

        dcl-ds ds_NMMLIMP2 likerec(NMMLIMPR2) ccsid(*exact)
        dcl-ds ds_NMWRKR likerec(NMWRKR) ccsid(*exact) ;

    // Get record to be updated
      EXTID = '053' ;
      EXTSKU   = 'A3507531197482438BTRRtbKgG8' ;
      chain (EXTID : EXITSKU) NMWRKF ds_NMWRKR ;

   // Get CCID(1208) Description value from source file
      SRCFILEID = 36694 ;
      CATLOG = '8BTRRtbKgG8' ;
      chain (SRCFILEID : CATLOG) NMMLIMPF2 ds_NMMLIMP2 ;

   // 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

Now,
(green screen) Debugging this skeleton I suspect that the %subst(xxxx)
fails
but I may be wrong (not my 1st time)

The (source)  NMMLIMP2.ITEMNAME field is a 512 long, nullable, CCID(1208)
VARLEN(30)
The (target)    NMWRKR.ITEMNAME8 field is a 128 long not nullable
CCID(1208)

Any help will be greatly appreciated.

TIA
Gad
-- 
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: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.