Implementing code pages both in a COBOL program and in the CV.


Article ID: 53031


Updated On:





It is possible to implement a code page at both the system level and the program level. This document discusses the interaction of these two.


A codepage can be specified for a particular COBOL program via a COBOL compile parm that you can override, like RENT, RES, TRUNC,
MAP, etc. You can see the parameter value in a COBOL compile listing; CODEPAGE(1140) is the default.

The IDMS default codepage in RHDCCODE is also 1140. See SYSTEM OPERATIONS 15.2 Customizing RHDCCODE for information on using an alternate codepage.

IBM's website documents how the COBOL codepage can impact host variable declaration. Their document that discusses codepages in COBOL, includes a section titled 'Notes on COBOL variable declaration and usage'. This document indicates that specification of a particular codepage can have an impact on variable declaration within the program.

All documentation is consistent in saying that the CODEPAGE compiler option must match your database CODEPAGE option. The implication is that the CODEPAGE compiler option can determine how the program interprets whatever data is stored in the database. The CV codepage will determine how the data is stored in binary. So if they aren't the same, the displayed data could potentially be different from what's in the database. The impact on having different codepages specified will vary depending on the specific instruction or situation. These should always match, if specified at all.

As an example, consider a COBOL program that calls service program IDMSIN01. In this case, the COBOL code page is not relevant for the
IDMSINO1 call itself. At the point you call IDMSIN01, you are passing a string of data (either EBCDIC or ASCII). IDMSIN01, if called for a string conversion function, will convert that string using the IDMS code table. The COBOL code page might have had an effect on how the string was built before the IDMSIN01 call and it might have an effect in how the converted string is used in a subsequent COBOL instruction. If the code pages were different, it could lead to unpredictable results.


Component: IDMS