Example of Code Page Conflicts in .NET COBOL

Note: The following applies to .NET COBOL only.

Visual Studio creates partial classes in COBOL to give programmatic access to WPF and WCF user interfaces. These partial classes are auto-generated and can then be updated by you or Visual Studio.

In the following example:

If PicLen.cbl is previously existing code or is a new hand-entered source file, it is not encoded using the platform default code page. For example, in the United Kingdom this is code page 1252, or on a Japanese locale machine, it is most likely the Shift-JIS code page 932.

When PicLen is called from WindowStuff, as follows, one code page calls another:
       call "PicLen" using stuff lStuff

Calling one code page from another is not supported directly. The COBOL run-time system generates an error when the application is run. The following source code for Window1 shows the code that handles this and displays the exception:

When PicLen and Window1 are encoded in different code pages, the application produces the following exception: