|
Am 08.02.2025 um 17:27 schrieb smith5646midrange@xxxxxxxxx:
I used the C function open() and created the file with 1208. I then wrote to it normally via the C write() function.
When I connected to it via the Access IFS tools, the contents were garbage. When I changed the variable in the program to also be CCSID 1208 as shown below, the contents were readable.
Am I overlooking something?
-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Jon Paris
Sent: Friday, February 7, 2025 5:40 PM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: variable CCSID for a variable
Maybe I'm missing something, but there are two ways of writing to the IFS that I am aware of. One uses the C functions and the other uses SQL. In both cases the code page can be specified - on the open() for the C functions and the Write for SQL. Both values can be passed as variables or hard-coded as literals.
So .... ???
Jon Paris
Jon.Paris@xxxxxxxxxxxxxx
On Feb 7, 2025, at 3:12 PM, smith5646midrange@xxxxxxxxx wrote:
I have a program that writes data to the IFS.
Strings are concatenated into dataString. Eventually dataString is
written to the IFS. It used to only write UTF-8 so it utilized the
CCSID on the variable as follows.
dcl-s dataString varchar(1048576) ccsid(1208);
Now my client has times they want to write ebcdic instead of utf8. Is
there a way to make the ccsid on the above variable a variable that I
can pass into my program? I would rather not write code like this.
First because it is ugly to have these if statements throughout the
code (I know, I can create a function and it won't be as bad) but
second we are now locked into using only two CCSIDs and I would have
to change the program if they decided that they want a third or fourth
CCSID. With a parm, I can just say give it a try.
dcl-s dataString1208 varchar(1048576) ccsid(1208);
dcl-s dataString37 varchar(1048576) ccsid(37);
if parmCCSID = UTF8
append to dataString1208
else
append to dataString37
endif
--
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: 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
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
--
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: 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 https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
--
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: 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 https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.
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.