SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Host Variables in COBOL Programs
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
4-11
Fixed-Length Character Data
Host variable source code for storing KANJI characters in SQL/MX Release 1.8:
A PIC X(100).
Host variable source code for storing KANJI characters in SQL/MX Release 2.x:
A CHARACTER SET KANJI PIC X(100).
Guidelines for Revising KANJI/KSC5601 Character Set Host
Variables
Follow these guidelines when rewriting an application that contains KANJI or KSC5601
character sets for SQL/MX Release 2.x:
•
Use the character set clause CHARACTER SET IS KANJI or CHARACTER SET
IS KSC5601.
•
The encoding for KANJI is the double-byte subset of the Shift-JIS, with no check
on code points performed by NonStop SQL/MX. For the best results, use the big-
endian byte order to denote a KANJI character.
•
The encoding for KSC5601 is the double-byte subset (Code set 1) of EUC_KR,
with no check on code points performed by NonStop SQL/MX. For the best results,
use the big-endian byte order to denote a KSC5601 character.
•
In COBOL embedded applications, each KANJI/KSC5601 character is represented
by two single-byte characters. When you copy KANJI/KSC5601 objects, always
use the correct number of bytes to ensure the entire object is moved.
Embedded COBOL Applications With UCS2 Literals
Because COBOL only understands single-byte character types, the byte order matters
when UCS2 literals are encoded in the application. Because the targeted execution
machine (NonStop system) is a big-endian machine, the byte order of each UCS2
character entered should be big-endian. For example, the UCS2 character -U+2021
(the double dagger sign) should be coded:
move X”20” & x”21” to host-variable.
Fixed-Length Character Data
Use the PICTURE clause to declare a host variable for fixed-length character data
(CHAR data type):
PIC[TURE] X (length)
The length value must be a positive integer and not greater than 4096. Instead of
length, you can specify multiple Xs, with each X representing one character position.