2

I am trying to copy an IFS stream file to a AS400 data file, but with the default CCSID setting the data copied ended up as some strange characters. Using cat command under QSH can display the content of the stream file correctly so I suspect that this has something to do with the CCSID. My question is how to determine what is the correct CCSID to use in my case?

God_of_Thunder
  • 753
  • 3
  • 20
  • 46

1 Answers1

4

Check the source and destination file CCSID's.

The -S option to ls from qsh will identify the IFS file CCSID.

DSPFD will display the library file attributes.

If you can cat the file the issue is most likely the destination file CCSID. The most common library file CCSID is 37 for EBCDIC.

You can check the system default CCSID with DSPSYSVAL QCCSID.

The CPYFRMIMPF command will convert the character data based upon the IFS file CCSID and the library file CCSID. CRTPF defaults to the job CCSID (inherited from the system CCSID).

James Allman
  • 40,573
  • 11
  • 57
  • 70
  • @God_of_Thunder The system should take care of itself assuming `QCCSID` is set correctly. What are the source (IFS) and destination (QSYS) CCSID's? – James Allman Jun 11 '12 at 16:37
  • Sorry for accepting it so late. Actually the problem was caused by the default job CCSID so I have to use RTVJOBA to retrieve it and assign to CPYFRMIMPF. But still your answer provided a useful insight. Thanks. – God_of_Thunder Jun 18 '12 at 14:37
  • Use of the "default" job CCSID implies that the job CCSID is incorrect. Better would be to ensure first that the QCCSID system value is appropriate (especially **not** 65535), and second that the job CCSID is correct. Job CCSID can be set with CHGJOB CCSID(), but setting the user profile once with CHGUSRPRF CCSID() is better than changing each job. (Ideally, the QCCSID system value could take care of everyone and every job.) – user2338816 Apr 05 '14 at 14:47