Strovent SystemsSign in
Reference

CCSID 65535 on IBM i, hex output and "no conversion"

What CCSID 65535 means on IBM i, why data shows up as hex in downloads and SQL tools, how the job CCSID is chosen, and how to fix it.

CCSID 65535 tells IBM i that data is binary: never convert it. Text tagged 65535 is passed along as raw EBCDIC bytes. That is why a download or a query from a PC tool can show C8C5D3D3D6 or unreadable characters where you expected HELLO.

On a 5250 screen the same data often looks fine, because the screen and the data are both EBCDIC. The trouble starts when the data leaves the system.

Where 65535 comes from

  • The system value. QCCSID is shipped as 65535.
  • The user profile. A profile's CCSID defaults to *SYSVAL, which means QCCSID.
  • The job. A job takes its CCSID from the user profile it runs under. So on an unchanged system, jobs run with CCSID 65535.
  • The file. A physical file created with CRTPF and a record length, with no DDS or SQL, is always CCSID 65535. Some tools, Query/400 among them, also create output files with 65535 fields.

The job default CCSID

When the job CCSID is 65535, IBM i also sets a default CCSID for the job based on its language ID (LANGID). New DDS-created files take their CCSID from it. If the job CCSID is anything other than 65535, the default CCSID is the same as the job CCSID.

What 65535 breaks

  • Database conversion. If the job CCSID is 65535, database input and output do not convert character data at all.
  • Connections to other systems. IBM notes you may not be able to connect a job with CCSID 65535 to an unlike database system. Messages to look for are SQ30073 (DDM parameter X'0035' not supported) and SQL0332 (conversion between two CCSIDs not valid).
  • Downloads and PC tools. Fields tagged 65535 arrive as hex unless the client is told to force conversion.

How it is fixed

  • For your current job only: CHGJOB CCSID(37), using the CCSID for your language (37 is US English). It lasts until the job ends.
  • For one user: an administrator changes the user profile's CCSID with CHGUSRPRF.
  • For the whole system: an administrator changes QCCSID with CHGSYSVAL, choosing a CCSID that suits most users.
  • For a file stuck at 65535: the CCSID of a program-described (CRTPF record length) file cannot be changed. Create a new file with the right CCSID through DDS or SQL and copy the data with CPYF.

Forcing a client to convert 65535 data only makes sense when the field really holds text. If it holds true binary data, conversion damages it.

Sources

Spotted a mistake? Email [email protected].