skip to main content

Library Routines : C$CODESET

C$CODESET
The C$CODESET library routine translates a string from EBCDIC to ASCII and vice versa.
Syntax:
 CALL "C$CODESET" USING transFlag
Parameters:
Indicates the type of text in TransString, and whether to apply Length when performing the translation. TransFlag takes one of the following values: 0 Indicates that TransString contains EBCDIC and that Length specifies the length of the string to translate to ASCII. 1 Indicates that TransString contains ASCII and that Length specifies the length of the string to translate to EBCDIC. 2 Indicates that TransString contains EBCDIC and that 256 bytes of data should be translated to ASCII. The Length parameter is ignored. 3 Indicates that TransString contains ASCII and that 256 bytes of data should be translated to EBCDIC. The Length parameter is ignored.
Return code:
returnCode can be any signed numeric data item and provides additional information:
Examples:
Example - Translate a string from ASCII to EBCDIC
working-storage section.
77 transFlag   pic 9(2comp-x.
77 strLen      pic 9(9comp-x.
77 transString pic x(256).
77 retCode     pic s9(1).
procedure division.
   move "This is the ASCII text" to transString
   move 1  to transFlag
   move 22 to strLen
   call "c$codeset" 
              using transFlag, strLen transString

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left