ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

CCSID issue

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

  • CCSID issue

    Please help!!!

    has anyone recently encountered this error/issue??

    Message ID . . . . . . : CPDB610

    Date sent . . . . . . : 04/08/08 Time sent . . . . . . : 15:01:39



    Message . . . . : File CCSID incorrect.



    Cause . . . . . : The file CCSID was 01252, but the data in the file looks

    like EBCDIC. A CCSID of 00500 is being used.

    Recovery . . . : If another CCSID is needed, use F15 to change to the

    desired CCSID.





    I have a process that works great on another as400...it creates files, places them on the IFS, and by SSH script, sends them to a server...The process has been replicated on a different as400 (we have multiple companies) and modified for their file names etc...there are 3 files placed on the IFS...2 are empty and show 1252 for CCSID...however, the 3rd file contains data that needs to be sent via SSH ... for some reason, the CCSID keeps being changed from 1252 to 500. When I view the file's attributes, it shows 1252...however when I display the data in the file i get the ccsid incorrect error.

    What I need to know is how to correct this issue. I did not have this problem on our other as400's or with either of the other 2 apps that were created for SSH purposes (i had other issues...but not this one!)...

    am hoping someone else has had this problem and can share their solution...

    thanks!

  • #2
    Re: CCSID issue

    At times you'll find that a stream file in your IFS is 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.

    You need to convert the data in the stream file, for that you
    can use QShell's ICONV command to convert it. This does not
    set the CCSID of the resulting file properly, but we do that.

    The following command converts the data in ORGFIL.TXT from
    CCSID 37 to CCSID 819 and writes the output to NEWFIL.TXT:
    PHP Code:
    STRQSH CMD('iconv -f 37 -t 819 /path/to/orgfil.txt > /path/to/newfil.txt 
    && setccsid 819 /path/to/newfil.txt'

    Another way to convert the data in the file is with the CPY CL command.
    PHP Code:
    CPY OBJ('/path/to/orgfil.txt'TOOBJ('/path/to/newfil.txt') +
          
    FROMCCSID(37TOCCSID(819DTAFMT(*TEXT
    Last edited by jamief; May 13, 2008, 07:28 AM. Reason: formatting of code
    SAM

    Comment


    • #3
      In case it helps others, I had this same problem and fixed it by adding the CCSID parameter to the data-definition of line of text I was writing to the file:

      dcl-s line char(256) ccsid(1252);

      The file was opened with CCSID of 1252.
      The field 'line' is filled with data and written to the file.
      When I made that change, the text in the file was now readable from PC/Linux/PHP code.

      Comment

      Working...
      X