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.
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
Works like a champ. Thanks Walt.
or create a new file with touch -C CCSID
Jonathan