[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: IFS file being created and opened with incorrect CCSID of 37, not 819.
Hi Paul.
I do not recall exactly what the reason is but there is a thing with ccsid 819 if you open the file and write to it directly. If you look at Scott's example17 in LIBHTTP you will find this piece of code.
// ------------------------------------------
// create new stream file in IFS
// tag it with CCSID 1208 (UTF-8)
// ------------------------------------------
unlink(embfile);
fd = open(embfile: O_CREAT+O_CCSID+O_WRONLY
: S_IRUSR + S_IWUSR: 819);
callp close(fd);
// ------------------------------------------
// Open stream file for appending data
// and write embedded XML document to it
// ------------------------------------------
fd = open(embfile: O_WRONLY+O_TEXTDATA);
xmlhdr= '<?xml version="1.0" encoding="iso-8859-1"?>' + x'0d25';
writeConst(fd: xmlhdr: %len(xmlhdr));
writeConst(fd: value: %len(value));
callp close(fd);
In short you need to create the file with 819, close it and then reopen it for append and it will translate to ascii.
Ronnie Visser
+27 11 012 8700.
082 322 7920
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, January 04, 2012 7:26 AM
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: IFS file being created and opened with incorrect CCSID of 37, not 819.
Hi Paul,
I would consider adding both O_TEXTDATA and O_TEXT_CREAT if you want the
IFS APIs to automatically translate data between ASCII & EBCDIC.
More detailed info here:
http://www.systeminetwork.com/article/rpg-programming/character-set-translation-with-the-open-api-65965
For future questions about stuff like this, please do not use this
mailing list.
Instead, please consider the System iNetwork forums (web based):
http://www.systeminetwork.com/forums
Or, the RPG400-L mailing list at Midrange.com (e-mail based):
http://www.midrange.com/lists.htm
I'm a regular at both places, and I'll be around to help with your
RPG/IFS questions. It's just not on-topic for the FTPAPI/HTTPAPI list.
Thanks!
On 1/3/2012 10:57 PM, Steinmetz, Paul wrote:
> Scott,
>
> The correction you suggested did resoslve the CCSID issue, however, the
> file is still not viewable when opened using Notepad on the IFS.
>
> Do I need O_TEXTDATA to correct this issue?
>
> This file is a script, used by SFTP (SSH), for secure file transfers.
>
>
> c eval fd = open('/home/CPASFNBA/NBA_Test.txt':
>
> c O_WRONLY+O_CREAT+O_TRUNC+O_CCSID:
>
> c S_IRUSR+S_IWUSR+S_IRGRP:
>
> c 1252 )
>
>
> Thanks
>
> Paul
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------