Re: IBM i code page / CCSID

Niels Liisberg <nli-y1igGha7WhZnI0JKdf8LmQC/[email protected]> Thu, 8 Dec 2022 19:03:45 +0100
Newsgroups gmane.comp.lang.as400.c
Message-ID <CADAk_-hB8vq3pb6d7WxE6R54D-q+3E08=fw1PJNSsD3A0=jvYQ@mail.gmail.com>
also set your job to that ccsid

CHGJOB CCSID(37)

And if you are using a 5250 - the remember to set that to to 37

Also the source file - it using so , has to be set to that ccsid ...



On Thu, Dec 8, 2022 at 12:19 AM Roger Lacroix <[email protected]>
wrote:

> All,
>
> I'm a newbie programmer on IBM i (OS/400) and I need a little bit of help.
>
> I'm having a weird problem with EBCDIC and square brackets, pretty much
> as described here:
>
> https://www.ibm.com/support/pages/what-impact-changing-qccsid-shipped-65535-another-ccsid
>
> Recently, a customer was trying out a program but it was not working. It
> took a couple of days to realize that they were running their system on
> a different code page. At first, I thought I would add their code page
> to the hard-coded list but then I thought that solution was stupid and
> started hunting for a proper solution.
>
> I decided that what I needed was a lookup table based on the code page
> (CCSID) and the HEX values for the square brackets. The trick was
> figuring out how to get the code page from the OS (operating system).
> After what felt like a millions searches, I can across the nl_langinfo
> subroutine. It is available on AIX, Linux, IBM i and z/OS. If you call
> nl_langinfo subroutine with the parameter of CODESET then it will return
> the code page (aka code set, CCSID) as a string.
>
> Next, I found 101 EBCDIC code pages and created a lookup table of the
> square brackets in sorted order by code page. Finally, I created a
> routine to issue the nl_langinfo subroutine and then perform a binary
> search of the lookup table and set the correct square brackets for the
> program to use.
>
> I found what I thought was a solution by using the nl_langinfo(CODESET)
> call as detailed here:
>
> https://www.ibm.com/docs/en/i/7.5?topic=functions-nl-langinfo-retrieve-locale-information
>
> I wrote about the lookup table and routine here:
> https://www.capitalware.com/rl_blog/?p=7060
>
> When I run a test program with the nl_langinfo(CODESET) call on my
> system, it returns 37 for the code page/CCSID.  When I run the following
> commands on my system:
>
> DSPSYSVAL SYSVAL(QCCSID)
> DSPSYSVAL SYSVAL(QCHRID)
>
> They both return code page/CCSID of 37.
>
> So I gave the test program to the customer.  When they run the program
> it returns 37 for the code page/CCSID.  But when the customer run those
> 2 "DSPSYSVAL SYSVAL" commands, they return 273 for code page/CCSID. And
> yes they are in Europe.
>
> So, my question is to those IBM i experts, what am I doing wrong. Note:
> The code that I am using was posted in my blog posting.  I don't
> understand why it didn't return 273 for code page/CCSID.
>
> Is there a better way from a C program to retrieve the correct code
> page/CCSID from the IBM i system?
>
> Help please.
>
> Regards,
> Roger Lacroix
> Capitalware Inc.
>
>
> --
> This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
> mailing list
> To post a message email: [email protected]
> To subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/c400-l
> or email: [email protected]
> Before posting, please take a moment to review the archives
> at https://archive.midrange.com/c400-l.
>
> Help support midrange.com by shopping at amazon.com with our affiliate
> link: https://amazon.midrange.com
>
-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com