Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iconv & IFS CCSID issues

229 views
Skip to first unread message

Mr. K.V.B.L.

unread,
Sep 10, 2008, 1:06:25 PM9/10/08
to
WARNING: some of you have already figured out that I'm a former Unix
person, so I live & breathe on the IFS.

When you run the command-line version of iconv, say, like so:

iconv -f 37 -t 1208 ebcdic.txt > utf-8.txt

things work fine EXCEPT when you do "ls -lS utf-8.txt" the 'official'
codepage is 37. I'm assuming this is because 37 is the default
codepage of my job and simple use of the redirection operator
guarantees file creation with the default codepage. No problem.

If you go and use the 'cat' command on this file, garbage gets
displayed. Fair enough.

Funny though, if you EDTF 'utf-8.txt', the EDTF command is somehow
smart enough to know that something is wrong because it displays the
file correctly (meaning you can read the contents and it's not
garbage) and tells you the codepage is wrong. If you go into the
'services' of EDTF and change the codepage to 1208 (UTF-8) and save,
then use the 'cat' command, the cat command will display the file
correctly and not as garbage.

I don't have a problem with any of this, but my question is once
you've converted data on the IFS, how can you then go and tell the
system what the real codepage of the data now is without going through
the hoops with EDTF? With QSYS files you have CHGPF and CHGSRCPF to
change codepages but I'm coming up empty on stream files.

As always, my thanks to this group. Without it I'm sure I would have
cut my wrists a long time ago.

Walt Madden

unread,
Sep 10, 2008, 2:23:34 PM9/10/08
to
Mr. K.V.B.L. wrote:
> I don't have a problem with any of this, but my question is once
> you've converted data on the IFS, how can you then go and tell the
> system what the real codepage of the data now is

Try the "attr" utility:
attr utf-8.txt CCSID=1208

More attr info here:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahz/attr.htm

--
-----
Walt Madden
IBM i software development

Mr. K.V.B.L.

unread,
Sep 10, 2008, 3:02:24 PM9/10/08
to
On Sep 10, 1:23 pm, "Walt Madden" <noem...@noemail.ibm.com> wrote:
> Mr. K.V.B.L. wrote:
> > I don't have a problem with any of this, but my question is once
> > you've converted data on the IFS, how can you then go and tell the
> > system what the real codepage of the data now is
>
> Try the "attr" utility:
> attr utf-8.txt CCSID=1208
>
> More attr info here:http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahz/att...

>
> --
> -----
> Walt Madden
> IBM i software development

Works like a champ. Thanks Walt.

Jonathan Bailey

unread,
Sep 11, 2008, 4:59:11 AM9/11/08
to

or create a new file with touch -C CCSID

Jonathan

0 new messages