This routine supports the translation of a text string from EBCDIC to ASCII, or ASCII to EBCDIC.
CALL "C$CODESET" USING TRANS-FLAG, LENGTH, TRANS-STRING GIVING RETURN-VALUE.
TRANS-FLAG PIC 9(2) COMP-X.
I ndicates the type of text in TRANS-STRING, and whether to apply LENGTH when performing the translation. TRANS-FLAG takes one of the following values:
0 | Indicates that TRANS-STRING contains EBCDIC and that LENGTH specifies the length of the string to translate to ASCII. |
1 | Indicates that TRANS-STRING contains ASCII and that LENGTH specifies the length of the string to translate to EBCDIC. |
2 | Indicates that TRANS-STRING contains EBCDIC and that 256 bytes of data should be translated to ASCII. The LENGTH parameter is ignored. |
3 | Indicates that TRANS-STRING contains ASCII and that 256 bytes of data should be translated to EBCDIC. The LENGTH parameter is ignored. |
LENGTH PIC 9(9) COMP-X
Specifies the length of the string to translate.
TRANS-STRING PIC X(n)
Contains the string to translate and the result of the translation.
RETURN-VALUE Numeric data item
Returns the number of characters translated, or zero if an error occurred.