[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: writing CLOB to IFS file - CCSID issue



Hi Kara,

Your problem, then, is that your IFS file is in EBCDIC.  The PC can't 
read EBCDIC -- it's an ASCII machine.  Unlike IBM i (OS/400), it does 
not understand CCSIDs so can't use them to translate the file for you.

One solution is to configure NetServer to do the translation for you.
This is done in iSeries Navigator under "File Systems".  right-click the 
share name that you are using, click "Properties" and under "text 
conversion" ask it to translate files with a particular extension.

Personally, I don't like that solution, because now my Windows apps can 
never get the data with it's original binary values... and often times 
that causes headaches for me.  Instead, I'd suggest that you translate 
the file to ASCII in the IFS.

One easy way to do that is with the CPY CL command.  Copy the data with 
DTAFMT(*TEXT) FROMCCSID(*OBJ) TOCCSID(1252) and that should translate it 
to ASCII for you.

A third idea -- which I haven't tried, but if it works, it'd be the best 
choice -- would be to pre-create the IFS file as an ASCII file so that 
when the SQL statement loads the data into it, it automatically 
translates it.  This would be a matter of creating the file with the 
open() API and using the O_CCSID option to assign an ASCII CCSID.  As I 
said, I haven't tried this yet.

Finally, my last thought is...  why extract something from a CLOB and 
write it to the IFS to begin with?  Why not have a PC app retrieve teh 
CLOB via JDBC or ODBC (which should translate automatically) and then 
use it from the PC?   Or have a CGI program that retrieves the CLOB and 
returns it directly instead of writing it to the IFS?   But these are 
just thoughts...  the way you're doing it should work, provided that the 
file is set up properly.

Also...  I'm missing how this discussion is related to HTTPAPI?  Are you 
planning to send the file via HTTP?

Kara Burkhalter wrote:
>    My RPG/SQL code is producing the file on the IFS.  If I do wrklnk to
>    that file I can view the html source code that was in the clob.  If I
>    try to open the file from the IFS from my pc thru Ops Navigator I
>    don't get the correct data and it appears to be CCSID problem.
>    Thanks
>    Kara
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------