Exchanging data with Host software

Because MVS, VM, DOS/VSE and OS/400 use the EBCDIC code scheme and OS/2 uses the ASCII code scheme, character-data exchange between a host system and a PC requires translation of strings from/to EBCDIC codes to/from ASCII codes. DBCS-unique considerations on the code-conversion are:

┌──────────────────────────────────────────────────────────────────────┐│WinCpTranslateString and TrnsDt are for converting from/to ASCII      │
│strings to/from EBCDIC strings.                                       │
└──────────────────────────────────────────────────────────────────────┘

The most noticeable difference between the two conversion services is that WinCpTranslateString is a common API across SBCS and DBCS OS/2, while TrnsDt is packaged in DBCS OS/2 only. interface on DBCS OS/2. When calling TrnsDt from 32-bit code, you need to take problems on linkage conventions, 16-bit pointer declaration and structure alignment. We are going to show a sample program in Example of TrnsDt usage from 32-bit code (source: MISCWIN.C).

┌─────────────────────────┬──────────────────────────────┬──────────────────────────────┐
│                         │WinCpTranslateString          │TrnsDt                        │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Supported code pages     │between any code pages        │between PC combined code pages│
│                         │                              │and Host SBCS, DBCS or        │
│                         │                              │combined code pages           │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Availability             │a common API across SBCS and  │available only at DBCS OS/2   │
│                         │DBCS OS/2                     │                              │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Usage of program types   │PM applications               │any type of OS/2 programs     │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Control code conversion  │converts to substitution      │maps control codes            │
│                         │characters                    │                              │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Round-trip conversion    │Not supported                 │Supported                     │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Substitution characters  │x'7F' or x'FF'                │x'7F' or x'3F'                │
│at SBCS code pages       │                              │                              │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Returned value when a    │no error codes ( A string is  │error code 111                │
│string overflows at a    │truncated carefully so as to  │                              │
│target code page         │keep DBCS string validity)    │                              │
├─────────────────────────┼──────────────────────────────┼──────────────────────────────┤
│Options                  │no options                    │option to produce pseudo SO/SI│
│                         │                              │code in PC, option to specify │
│                         │                              │a conversion table            │
└─────────────────────────┴──────────────────────────────┴──────────────────────────────┘


[Back: Preparing icons]
[Next: Converting ASCII DBCS to EBCDIC DBCS]