I'm trying to make use of the table function qsys2.ifs_read to read an IFS text file.
I have a test rpg pgm, with procedure, and when I used this syntax -
select LINE_NUMBER,LINE from table(qsys2.ifs_read('/myFolder/IB_Log_2021_Nov23Tue_10.09.43_AM.txt',256))
with hard coded path & filename and it works from 5250 session! Thanks IBM & rpgpgm.com!

I'm trying to switch the procedure to accept a path/filename and embed that in
the pertinent sql and it's stopped working.
This is the error message i get on the prepare -
SQL0332: Character conversion between CCSID 65535 and CCSID 1200 not valid.

I changed the job ccsid in my session thus - CHGJOB CCSID(37) and it works.

fyi We are at V7R3M0 TR7, DSPSYSVAL SYSVAL(QCCSID) reveals 65535.

Any thoughts, suggestions or explanations on why this is happening are most welcome!


Here is the pertinent code...
dcl-proc #doIt_ThatWay ;
dcl-pi *n ;
pPathfile varchar(256) value options(*trim) ;
end-pi ;
dcl-s sqlstmt varchar( 512) ;
dcl-c apos x'7D' ;
sqlstmt = 'select LINE_NUMBER,LINE from table(qsys2.ifs_read(' +apos+ pPathfile +apos+ ',256))' ;
exec sql prepare stmt from :sqlstmt ;
exec sql declare mycsr cursor for stmt ;
exec sql open mycsr ;
end-proc ;

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

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