UTF-8 is a byte-oriented, variable-length Unicode encoding. In COBOL systems, it is commonly used at file, API, and database boundaries; programs convert between NATIONAL and DISPLAY text as needed.
123456* Typical conversion path 01 WIDE-NAME PIC N(40). 01 DISP-NAME PIC X(120). MOVE FUNCTION NATIONAL-OF("Łódź") TO WIDE-NAME MOVE FUNCTION DISPLAY-OF(WIDE-NAME) TO DISP-NAME * External layer writes DISP-NAME as UTF-8
Aspect | Description | Example |
---|---|---|
Encoding | Variable-length bytes | UTF-8 |
Conversions | NATIONAL-OF/DISPLAY-OF | DISPLAY-OF(WIDE) |
Boundaries | Files/APIs/DBs | HTTP, MQ, datasets |
1. What is UTF-8?
2. How do COBOL programs commonly handle UTF-8?
3. Which functions help convert NATIONAL to DISPLAY (for UTF-8 encoding later)?
4. What is a best practice for files and databases using UTF-8?
5. Which advantage does UTF-8 have for mixed-language text?