To solve this problem you can normally read the line-sequential file, then before using the contents of the record you can call a specific function for the translation.
If you’re using isCOBOL 2023R1 or later, you can use the C$STRING_CONVERT library routine, which specifically converts the content of an alphanumeric data item from one character set to another.
If you’re using an earlier version, you need to call a Java function for the translation. Attached is a COBOL sample program that reads a file to get a string and pass it with the input and output encoding desired to a Java program. The sample uses UTF-8 to Cp1252. The list of supported encodings is here: Supported Encodings.
Article ID: 263
Created: February 22, 2016
Last Updated: April 9, 2025
Author: Support KB Author
Online URL: https://support.veryant.com/phpkb/article.php?id=263