UNIVERSAL refers to the Universal Character Set (UCS), the basis for Unicode (ISO/IEC 10646). In COBOL, NATIONAL data (PIC N) typically maps to UCS-2/UTF-16. Use conversion functions to interoperate with DISPLAY data.
123456* UNIVERSAL (UCS) conversions with NATIONAL data 01 WIDE-TEXT PIC N(40). 01 DISP-TEXT PIC X(120). MOVE FUNCTION NATIONAL-OF("Curaçao – 東京") TO WIDE-TEXT MOVE FUNCTION DISPLAY-OF(WIDE-TEXT) TO DISP-TEXT DISPLAY DISP-TEXT
Aspect | Description | Example |
---|---|---|
UCS | Universal repertoire | ISO/IEC 10646 |
NATIONAL | PIC N mapped to UCS encoding | PIC N(30) |
Conversions | NATIONAL-OF, DISPLAY-OF | DISPLAY-OF(WIDE-TEXT) |
1. What does UNIVERSAL generally refer to in character encoding contexts?
2. Which COBOL feature typically maps to UCS-based encodings?
3. What is the relationship between UCS-2 and UTF-16?
4. What is a best practice when handling UNIVERSAL encodings in COBOL?
5. Which COBOL functions help convert between DISPLAY and NATIONAL text?