Double Byte Character Set
A Double Byte Character Set (DBCS) is a character encoding system where each character is represented by two bytes (16 bits), allowing for the representation of thousands of unique characters. In the mainframe and z/OS context, DBCS is essential for supporting languages with large character sets, such as Japanese, Chinese, and Korean, which cannot be adequately represented by single-byte character sets (SBCS) like EBCDIC or ASCII.
Key Characteristics
-
- Fixed-width encoding: Each character consistently occupies two bytes of storage, simplifying character processing and memory allocation compared to variable-width encodings.
- Language support: Primarily designed to support East Asian languages (CJK - Chinese, Japanese, Korean) that have extensive character repertoires far exceeding 256 characters.
- Mixed-mode data: Often coexists with Single Byte Character Sets (SBCS) within the same data stream or field, requiring specific handling using Shift-Out (SO) and Shift-In (SI) control characters to delimit DBCS segments.
- Encoding schemes: Common DBCS encodings on z/OS are typically EBCDIC-based, identified by specific Character Set Identifiers (CCSIDs) (e.g., CCSID 930 for Japanese, 935 for Simplified Chinese, 937 for Traditional Chinese, 942 for Korean).
- Storage and processing overhead: Requires twice the storage space per character compared to SBCS, impacting file sizes, database field lengths, and memory usage, and may incur additional processing for shift character handling.
- Display and printing: Requires DBCS-capable terminals (e.g., 3270 terminals with DBCS support via specific emulators), printers, and software to correctly render and print the characters.
Use Cases
-
- Internationalized applications: Developing COBOL, PL/I, or C programs on z/OS that process, display, or generate reports in Japanese, Chinese, or Korean for global users.
- Database storage: Storing customer names, addresses, product descriptions, or other textual data in DB2 or IMS databases for East Asian markets, often using
GRAPHICorVARGRAPHICdata types in DB2. - File processing: Reading and writing flat files containing DBCS data, which often requires specific record formats, data definitions, and utilities capable of handling DBCS.
- User interfaces: Presenting menus, prompts, and output on 3270 screens in DBCS languages, typically within CICS transactions, requiring DBCS-enabled terminal emulators.
- Batch reporting and printing: Generating reports with DBCS content for distribution in regions using these languages, which may involve specialized print utilities or report writers.
Related Concepts
DBCS is fundamentally linked to Character Set Identifiers (CCSIDs), which define the specific encoding rules for both single-byte and double-byte characters within a given code page. It is a subset of Mixed-Byte Character Sets (MBCS), where DBCS characters are interspersed with SBCS characters, typically delimited by Shift-Out (SO) and Shift-In (SI) control characters. This impacts how COBOL programs define PIC G (DBCS) or PIC N (National characters, often UTF-16 on z/OS) data types and how JCL utilities like SORT or IDCAMS handle character data, often requiring specific LOCALE or CODEPAGE parameters to ensure correct processing.
- Specify correct CCSIDs: Always explicitly define and use the appropriate CCSID for DBCS data in file definitions, database schemas, and application code to ensure data integrity, correct conversion, and proper display.
- Handle shift characters diligently: When working with mixed-byte data, ensure applications correctly identify, process, and preserve
SOandSIcharacters to avoid data corruption, truncation, or incorrect character rendering. - Allocate sufficient storage: Account for the two-byte per character requirement when defining field lengths in databases, file layouts, and program variables to prevent data overflow or truncation.
- Test thoroughly: Rigorously test DBCS applications with various character combinations, including edge cases, mixed-mode data, and different locales, across all