iconv & IFS CCSID issues - IBM AS400

This is a discussion on iconv & IFS CCSID issues - IBM AS400 ; 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 > ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: iconv & IFS CCSID issues

  1. iconv & IFS CCSID issues

    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.

  2. Re: iconv & IFS CCSID issues

    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/infoce...rzahz/attr.htm

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




  3. Re: iconv & IFS CCSID issues

    On Sep 10, 1:23*pm, "Walt Madden" 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/infoce...opic/rzahz/att...
    >
    > --
    > -----
    > Walt Madden
    > IBM i software development


    Works like a champ. Thanks Walt.

  4. Re: iconv & IFS CCSID issues

    On Sep 10, 8:02*pm, "Mr. K.V.B.L." wrote:
    > On Sep 10, 1:23*pm, "Walt Madden" 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/infoce...opic/rzahz/att...

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

    >
    > Works like a champ. *Thanks Walt.


    or create a new file with touch -C CCSID

    Jonathan

+ Reply to Thread