When you create Unicode database applications, you need to consider the implications for creating physical files, creating logical files, and for database input/output.
Unicode graphic fields can be created in physical files. This is done by specifying a G data type and a Unicode CCSID for the CCSID keyword.
The following example shows the DDS for a physical file containing four fields, and the command for creating the file:
A R FMT1 A EMPNO 6A A NAME 30G CCSID(1200) A DESCR1 500G CCSID(1200) VARLEN A DESCR2 500A CRTPF FILE(UNICODEPF) SRCFILE(CLR/QDDSSRC)
In the example:
You can specify the default (DFT) keyword for Unicode graphic fields. The default value can be specified as SBCS, bracketed-DBCS, or bracketed-DBCS-graphic character strings. If you do not specify the DFT keyword, the default value for fixed-length Unicode fields is the Unicode blank (hexadecimal 0020). For varying-length Unicode fields, the default is the empty string.
You can use logical files to map Unicode data to and from character, DBCS-open, or DBCS-graphic. This allows Unicode graphic data to be manipulated in a character based form.
The following example shows the DDS for a logical file containing 4 character fields. The Unicode graphic data is converted to character data when reading from the logical file, and character data is converted to Unicode graphic data when writing to the file.
R FMT1 PFILE(UNICODEPF1) A EMPNO A NAME A CCSID(37) A DESCR1 A CCSID(37) A DESCR2 G CCSID(1200)
Whenever reading or writing data from or to a field tagged with a Unicode CCSID to the job physical files, the data is passed as Unicode data without any conversions occurring. Regardless of the job CCSID, data is passed as Unicode data. When writing data to a logical file, the from CCSID is the job CCSID; however, if the job CCSID is 65535, the from CCSID is the CCSID of the field in the logical file.
Here are some scenarios from the previous physical and logical files. For the scenarios, the job CCSID is 297.
Scenario 1. When reading the data from the physical file:
Scenario 2. When writing the data to the physical file:
Scenario 3. When reading the data from the logical file:
Scenario 4. When writing the data to the logical file:
Scenario 5. If the job was 65535, the conversions for the previous fields are: