ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

changing the CCSID of a streamfile

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • changing the CCSID of a streamfile

    CHANGING THE CCSID OF A STREAM FILE

    From time to time, you'll find a stream file in your IFS
    that's marked with the wrong CCSID. I recently had a problem
    where a file in my IFS was full of ASCII data but was marked
    as CCSID 37 (US EBCDIC). This was a problem because the
    IBM-supplied commands didn't convert the data, since they
    thought it was already in EBCDIC.

    The CHGATR command can be used to change the CCSID of a
    stream file. Here's an example:

    Code:
    CHGATR OBJ('/path/to/myfile.txt') ATR(*CCSID) VALUE(819)
    Another way to do the same thing is with the SETCCSID command
    in QShell. Here's an example of that command:

    Code:
    STRQSH CMD('setccsid 819 /path/to/myfile.txt')
    If the data in the stream file also needs to be converted, you
    can use QShell's ICONV command to convert it. This does not
    set the CCSID of the resulting file properly, but we
    already know how to fix that!

    The following command converts the data in MYFILE.TXT from
    CCSID 37 to CCSID 819 and writes the output to YOURFILE.TXT:

    Code:
    STRQSH CMD('iconv -f 37 -t 819 /path/to/myfile.txt > /path/to/yourfile.txt 
    && setccsid 819 /path/to/yourfile.txt')
    Another way to convert the data in the file is with the CPY CL command.
    Here's an example of that:

    Code:
    CPY OBJ('/path/to/myfile.txt') TOOBJ('/path/to/yourfile.txt') +
          FROMCCSID(37) TOCCSID(819) DTAFMT(*TEXT)
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  • #2
    Re: changing the CCSID of a streamfile

    I am working in Saudi Arab, and our database have both English and Arabic languages. Some time we need to transfer (Download) reports / data from AS400 to PC or vice versa by mean of FTP / Client Access File Transfer wizard / Copy document from AS400 folder to PC by using CPYTOPCD.

    We are facing problem when we have data in Arabic or Arabic English mixed. I read your solutions and You explain many ways; I tried but could not get success. Can you please let me know some other ways or how I can handle this thing?

    Thanks in advance

    Regards,

    Raja
    Last edited by RAJA; March 3, 2008, 09:04 AM.

    Comment


    • #3
      Re: changing the CCSID of a streamfile

      hi Jamie

      while copying .CSV file from IFS location to my system, numeric field comes in exponential form eg. if value is 652726000182 it will be shown in 6.52726E+11 form.

      I need to show the field value as it is, not in exponential form. the file will be directly sent to user by email to can't change the format manually.

      any idea to resolve this.. ?

      thanks

      Comment


      • #4
        Re: changing the CCSID of a streamfile

        Is it Excel that is showing the data that way or the iseries. Excel by default will only show show many positions of a number.

        http://stackoverflow.com/questions/1...er-cell-format
        Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

        Comment


        • #5
          Re: changing the CCSID of a streamfile

          Hi Kishor:

          If you mouse over the letters of the column at the very top of the sheet the mouse will change to a vertical line with left and right arrows.
          Click and drag that symbol to expand the column and you will see all of the field.

          An alternative is to click the block between column a and row 1. That will highlight the entire sheet. If you hover between any 2 cells (a and b for example) and get the symbol as described above....double click and the entire sheet will be expanded.

          Best of Luck
          GLS
          Last edited by GLS400; February 19, 2013, 09:22 AM.
          The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

          Comment

          Working...
          X