× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Niels
As it happens, I came across a few web pages about reading ifs files using SQL
Using the following SQL statement

select * from
table(QSYS2.IFS_READ(
PATH_NAME =>
'/www/INBNDSVR/trans/INBNDSVR_203077082_req_.xml'))

This worked as the contents were displayed – and I saw that it contained an XML string

However, choosing a different ifs file I received the message
Character conversion between CCSID 65535 and CCSID 1200 not valid.
F1 prompt on this message displayed the following
Additional Message Information

Message ID . . . . . . : SQL0332 Severity . . . . . . . : 30
Message type . . . . . : Diagnostic

Message . . . . : Character conversion between CCSID 65535 and CCSID 1200
not valid.
Cause . . . . . : Character or graphic conversion has been attempted for
data that is not compatible. There is no conversion defined between CCSID
65535 and CCSID 1200.
If one CCSID is 65535, the other CCSID is a graphic CCSID. Conversion is
not defined between 65535 and a graphic CCSID.
If this is a CONNECT statement, conversion is not defined between the
default application requester SBCS CCSID and the application server SBCS
CCSID. If the second CCSID is 0, the application server did not return its
default SBCS CCSID. An application server other than DB2 for IBM i may not
support a CCSID of 65535.
Recovery . . . : Ensure that all character or graphic comparisons,

concatenation, or assignments are between columns or host variables with
compatible CCSID values.
If this is a CONNECT statement, change either the SBCS CCSID of the
application requester or the application server, so conversion between the
CCSID values is defined.

Alan Shore
Solutions Architect
IT Supply Chain Execution

[NHScsignaturelogo]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx

‘If you're going through hell, keep going.’
Winston Churchill

From: Niels Liisberg [mailto:nli@xxxxxxxxxxxxxxxxx]
Sent: Tuesday, December 21, 2021 8:35 AM
To: Alan Shore <ashore@xxxxxxxx>
Cc: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: [EXTERNAL] Re: Reading a file in the IFS

Hello Alan;

I guess the easiest wait is simply to open it with EDTF

try this - to see what I mean:

QSH CMD('touch /tmp/utf8error.txt')
CHGATR OBJ('/tmp/utf8error.txt') ATR(*CCSID) VALUE(1252)
QSH CMD('echo "Smørrebrødspålæg" > /tmp/utf8error.txt')
// This will be OK
EDTF STMF('/tmp/utf8error.txt')
// Now make the contents inconsistent with the ccsid on the attributes:
CHGATR OBJ('/tmp/utf8error.txt') ATR(*CCSID) VALUE(1208)
// This will fail
EDTF STMF('/tmp/utf8error.txt')
// with:
// 3 INVALID CHARCTERS FOR CCSID 01208 ENCOUNTERED IN DISPLAY RECORD 2. IF THE RECORD IS CHANGED, THEY WILL BE REPLACED WITH BLANK

.. So if you see the same error for your file the use
CHGATR OBJ('/tmp/utf8error.txt') ATR(*CCSID) VALUE(1252)
.. to bring it back to window-1252 (latin-1)

I hope this helps - Merry Christmas to you.







On Tue, Dec 21, 2021 at 2:00 PM Alan Shore <ashore@xxxxxxxx<mailto:ashore@xxxxxxxx>> wrote:
Thanks for the info Niels
Interesting
How can I tell if the data inside in 1252 – or not 1208?


Alan Shore
Solutions Architect
IT Supply Chain Execution

[NHScsignaturelogo]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>

‘If you're going through hell, keep going.’
Winston Churchill

From: Niels Liisberg [mailto:nli@xxxxxxxxxxxxxxxxx<mailto:nli@xxxxxxxxxxxxxxxxx>]
Sent: Tuesday, December 21, 2021 6:00 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>>
Cc: Alan Shore <ashore@xxxxxxxx<mailto:ashore@xxxxxxxx>>
Subject: Re: [EXTERNAL] Re: Reading a file in the IFS

I agree with Scott,

The error indicate a conversion error:

Perhaps the ccsid on IFS file - if you use WRKLNK you can see it - contains 1208 as file attribute BUT the data inside in 1252 ... This is common issue and o_ccsid will not help you there

In that case use:

CHGATR OBJ('/MY/IFS/FILE.TXT') ATR(*CCSID) VALUE(1252)




On Tue, Dec 21, 2021 at 5:48 AM Alan Shore via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>> wrote:
Thanks for your reply Scott
I'm not looking to change the ccsid
I'm trying to work out why I'm getting the error on the open
My guess was that this was due to the ccsid
But as stated, it was a guess as I am unable to find anything on the Web





Sent via the Samsung GALAXY S® 5, an AT&T 4G LTE smartphone


-------- Original message --------
From: Scott Klement <midrange-l@xxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxx>>
Date: 12/20/21 22:18 (GMT-05:00)
To: midrange-l@xxxxxxxxxxxxxxxxxx<mailto:midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: [EXTERNAL] Re: Reading a file in the IFS

Hi Alan,

I don't understand the question about changing the CCSID. What CCSID
are you trying to change? Typically, it converts from the CCSID of the
file to the CCSID of the job... You don't change the CCSID of the file
on fopen(), instead that would be done with the CHGATR CL command or the
setccsid QShell command. You'd do this before opening the file. Do you
want to change the CCSID that your program reads into instead of using
the job ccsid? If so, you can use the o_ccsid option on the fopen() call.

But... changing o_ccsid won't solve the problem.

The problem is that the file contains a string of bytes that's not valid
in UTF-8. UTF-8 requires bytes to be encoded in a particular way, and
you have a sequence of bytes that isn't valid by UTF-8 standards, so you
get the error.

Perhaps the file isn't actually UTF-8? Perhaps it's 819, or 1252, or
something else?

If this doesn't help, please provide more information. We need to know
how to reproduce the problem in order to truly tell you what's
happening. To facilitate that, give us a sequence of bytes that we can
place in a stream file, and then give us the exact parameters you're
using to fopen() so we can recreate the problem.

Good Luck!


On 12/20/2021 4:34 PM, Alan Shore via MIDRANGE-L wrote:
Hi folks
We are on V7r3
With the help of this group, I am using the
'_C_IFS_fopen'
'_C_IFS_fgets'
'_C_IFS_fclose'

For about a year now, and once I was told of what I was doing wrong, with no problems
Until now
I am using these functions for a new set of ifs files, and am receiving
C_ERRNO = 3490 which translates to an error string of 'Conversion error.'
On the _C_IFS_fopen finction

I believe it MAY be the ccsid of the ifs files that I am attempting to open - CCSID = 1208
Everything I have used these functions on up until now have been CCSID = 819 without incurring this problem'
I have tried to googel the answer to this but having little success
Is there anywhere in the function parameters that I can change the CCSID on the _C_IFS_fopen function?
If anyone can point me to where the write up to these functions can be found will be greatly appreiated

Alan Shore
Solutions Architect
IT Supply Chain Execution

[NHScsignaturelogo]

60 Orville Drive
Bohemia, NY 11716
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
E-mail : ASHORE@xxxxxxxxxxxxxxxxxxxx<mailto:ASHORE@xxxxxxxxxxxxxxxxxxxx>

'If you're going through hell, keep going.'
Winston Churchill

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

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

Help support midrange.com<http://midrange.com> by shopping at amazon.com<http://amazon.com> with our affiliate link: https://amazon.midrange.com<https://amazon.midrange.com><https://amazon.midrange.com<https://amazon.midrange.com>>
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L@xxxxxxxxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l<https://lists.midrange.com/mailman/listinfo/midrange-l>
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx<mailto:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx>
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l<https://archive.midrange.com/midrange-l>.

Please contact support@xxxxxxxxxxxxxxxxxxxx<mailto:support@xxxxxxxxxxxxxxxxxxxx> for any subscription related questions.

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

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-2024 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.