
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
When a webform calls a COBOL program with a hexadecimal value in it, the website is able to compile but when it runs it throws a runtime exception on the CALL statement. Example webform codebehind:
class-id _Default is partial
inherits type System.Web.UI.Page.
working-storage section.
method-id Page_Load is protected.
local-storage section.
procedure division using by value param-sender as object
param-e as type System.EventArgs.
CALL "PROGRAM1".
goback.
end method.
end class.
And example called program:
IDENTIFICATION DIVISION.
PROGRAM-ID. PROGRAM1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 TEST-VAR PIC X VALUE X"FF".
PROCEDURE DIVISION.
DISPLAY "HELLO WORLD".
STOP RUN.
If this is a COBOL program calling another COBOL program with a hexadecimal value in it, not within a website, the call works. Also, if X”FF” is replaced by the equivalent HIGH-VALUES it also works.
What’s wrong X”FF”? How can this be fixed?
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am assuming that the error message that you are receiving is a RTS 198 or some error about a Code Page conflict, is that correct?
The problem would occur because the web site itself (the .aspx file) is stored as UTF-8 containing the BOM (EF BB BF) at the start of the file and the program that you are attempting to call is stored as an OEM format like ANSI or some other non-UTF-8 codeset.
When compiling the program the compiler assumes that all source files are in OEM format unless this BOM is found and then it is determined to be UTF-8 and the compiler sets a flag within the compiled program so that the run-time system knows which codeset should be used in the program.
The compiler also scans the programs for any PIC X fields with VALUE clauses that may contain characters that may not be compatible between different codesets. If such a character is found then the compiler will set a flag so that the run-time system can check that only a program with a compatible codeset can call this program.
This is what the compiler is doing when it comes across your hex literal. It is treating it as an incompatible character because its value is > X"7F".
There are a couple of workarounds to this issue.
1. Open up your program source in Visual Studio and then under File-->Advanced Save change the encoding to be UTF-8 and then save the file.
2. Set the directive SOURCE-ENCODING"UTF8" in the project properties for the COBOL program with the X"FF" in it. (note: this directive cannot be set directly in the source program)
This topic is covered in the product documentation under Code Page Conflicts in .NET code.
Thanks.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
I am assuming that the error message that you are receiving is a RTS 198 or some error about a Code Page conflict, is that correct?
The problem would occur because the web site itself (the .aspx file) is stored as UTF-8 containing the BOM (EF BB BF) at the start of the file and the program that you are attempting to call is stored as an OEM format like ANSI or some other non-UTF-8 codeset.
When compiling the program the compiler assumes that all source files are in OEM format unless this BOM is found and then it is determined to be UTF-8 and the compiler sets a flag within the compiled program so that the run-time system knows which codeset should be used in the program.
The compiler also scans the programs for any PIC X fields with VALUE clauses that may contain characters that may not be compatible between different codesets. If such a character is found then the compiler will set a flag so that the run-time system can check that only a program with a compatible codeset can call this program.
This is what the compiler is doing when it comes across your hex literal. It is treating it as an incompatible character because its value is > X"7F".
There are a couple of workarounds to this issue.
1. Open up your program source in Visual Studio and then under File-->Advanced Save change the encoding to be UTF-8 and then save the file.
2. Set the directive SOURCE-ENCODING"UTF8" in the project properties for the COBOL program with the X"FF" in it. (note: this directive cannot be set directly in the source program)
This topic is covered in the product documentation under Code Page Conflicts in .NET code.
Thanks.