Skip to Content

How can I read data correctly from a line-sequential file that has a different encoding from the one used by isCOBOL?

Estimated Reading Time: 1 Minutes

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.

How can I read data correctly from a line-sequential file that has a different encoding from the one used by isCOBOL?
  • Attached Files
  • encoding.zip (1.29 KB) 96