Was that availabled on V7R1?

On Tue, Dec 2, 2025 at 9:32 AM Javier Sanchez <
javiersanchezbarquero@xxxxxxxxx> wrote:

Declare your target buffer like:

dcl-s myUtf8Buffer char(4096) ccsid(1208) inz;

Then, anything coming from any RPG variable that by default is EBCDIC (no
matter what EBCDIC CCSID), if you just simply assign that variable to your
utf-8 variable, the compiler will under-the-hood call an API that would
translate the data into utf-8.

Say you originally have another RPG variable:

dcl-s myOrigVar char(4096) inz; // Implicit CCSID from job or compile-time
(whatever, it's EBCDIC by default)

myOrigVar = 'This text is originally EBCDIC';
myUtf8Buffer = myOrigVar; // Implicit conversion to UTF-8.

Now, when you use the write() API, use your UTF-8 variable as the target
buffer.
You can always get the length of the actual buffer with
%LEN(%TRIM(myUtf8Buffer)). Use this length in the write() API.

Try it out and let us know.

HTH.

JS

El mar, 2 dic 2025 a las 9:08, Brad Stone (<bvstone@xxxxxxxxx>) escribió:

What is your system value for QCHRID? How about your jobs CCSID?

If either is 65535 that's the issue and it should be set to the proper
CCSID for your location.

On Tue, Dec 2, 2025 at 9:00 AM <konsult@xxxxxxxxxxxxxxx> wrote:

I need to create a file in the IFS and the file HAS to be encoded in
UTF-8
(CCSID 1208).

The machine is unfortunately running on V7R1 and that is due to a
software
package that cannot (as I am told be migrated to more current
releases).
So
writing with SQL is out of the equation, sadly.



I have tested a function based on Scott Klements writings and while it
works
with conversion to ASCII it fails when I change to CCSID 1208.



As per the example the IFS file is first created with 1208 as the
CCSID.
This works and is coded thus:



c eval fd = open('/home/ao/ch5_file3.txt':

c O_CREAT+O_WRONLY+O_CCSID:

c S_IWUSR+S_IRUSR+S_IRGRP+S_IROTH:

c 1208)



But when the file is closed an reopened this open gets an error:



c eval fd = open('/home/ao/ch5_file3.txt':

c O_WRONLY+O_TEXTDATA)



I receive an "open() conversion error"



Any suggestions? I assume that I need some other parameters for the
second
open when using UTF-8 but I have as yet not found which one to use or
possibly omit.











--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription
related
questions.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

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