Database management

Database management support provides default coded character set identifier (CCSID) values for database files on the system. All database files are assigned a CCSID. At file creation time, the CCSID is either explicitly assigned through DDS, SQL, or IDDU, or implicitly assigned the job default CCSID (DFTCCSID).

Database files support for CCSIDs

IBM® system files and licensed program database files are created with the CCSID of choice for each of the national language versions. Only the customer files are automatically assigned the CCSID of the job creating the file. You can use the Display File Description (DSPFD) command to view the CCSID of a file.

Program-described files are assigned CCSID 65535. If a CCSID is not explicitly specified on the CRTPF or CRTSRCPF command, database source files default to the job default CCSID at file creation.

If a database logical file is defined over several physical files, it is assigned a CCSID at the field level and assumes the CCSID value of the physical file. Logical files cannot be explicitly assigned a CCSID value.

Database fields and support for CCSIDs

Except for numeric database fields, database fields are supported by CCSIDs. You can use the Display File Field Description (DSPFFD) command to view the CCSID of the fields in a file.

Hexadecimal fields are assigned CCSID 65535.

An implicit CCSID value is assigned to the following fields if a CCSID was not explicitly assigned through DDS, SQL, or IDDU at file creation:

  • Physical-file character
  • DBCS-open
  • DBCS-only
  • DBCS-either
  • Graphic

The implicitly assigned CCSID is the job default CCSID, or a CCSID associated with the job default CCSID.

  • A character field is assigned the single-byte character set (SBCS) CCSID that is associated with the job default CCSID.
  • A DBCS-open, DBCS-only, and DBCS-either field is assigned the mixed byte CCSID.
  • A Graphic field is assigned the double-byte character set (DBCS) CCSID that is associated with the job default CCSID.

For example, if the job default CCSID is 5026 (which is a CCSID that identifies mixed data), an SBCS character field is assigned the SBCS CCSID associated with 5026. Thus, the CCSID for that field is 290. If there is no CCSID of the required character set type then a CCSID of 65535 is used.

Database logical-file fields are assigned a CCSID value based on their data type and the data type of the underlying physical file field.

Database management and conversion support for CCSIDs

Database management support converts non-graphic character data read from, or written to, database files using the file CCSID and the job CCSID.

  • If data is being read from a database file and the CCSID of the file is the same as the job CCSID, no conversion is done.
  • If data is being read from a database file and the CCSID of the file and the job CCSID are different, the data is converted to the CCSID of the job.
  • If data is being written to a database file and the CCSID of the file is the same as the job CCSID, no conversion is done.
  • If data is being written to a database file and the CCSID of the file and the job CCSID are different, the data is converted to match the CCSID of the file.

No conversion is performed if either the CCSID of the job or the CCSID of the database file is equal to 65535.