Writing code to run with IBM Enterprise COBOL for z/OS
You can use COBOL for Linux® on x86 to develop new applications, and take advantage of the productivity gains and increased flexibility of using your Linux on x86 system. However, when you develop COBOL programs, you need to avoid using features that are not supported by IBM® Enterprise COBOL for z/OS®.
About this task
Language features: COBOL for Linux on x86 supports several language features that are not supported by Enterprise COBOL. As you write code on Linux on x86 that is intended to run on z/OS, avoid using these features:
- Code-page names as arguments to the
DISPLAY-OF
andNATIONAL-OF
intrinsic functions READ
statement using thePREVIOUS
phraseSTART
statement using<
,<=
, orNOT >
in theKEY
phrase>>CALLINTERFACE
compiler directive
Compiler options: Several compiler options are not available on Enterprise COBOL. Do not use any of the following compiler options in your source code if you intend to port the code to z/OS:
BINARY(NATIVE)
CALLINT
(treated as a comment)CHAR(NATIVE)
FLOAT(NATIVE)
File names: Be aware of the difference in file-naming conventions between Linux and host file systems. Avoid hard-coding the names of files in your source programs. Instead, use mnemonic names that you define on each platform, and map them in turn to mainframe ddnames or environment variables. You can then compile your program to accommodate the changes in file-names without having to change the source code.
Specifically, consider how you refer to files in the following language elements:
ACCEPT
orDISPLAY
target namesASSIGN
clauseCOPY
statement (text-name or library-name)
File suffixes: In COBOL for Linux on x86, when you compile using one of the cob2 commands, COBOL source files that have suffix .cbl or .cob are passed to the compiler. In mainframe COBOL, when you compile in the z/OS UNIX file system, however, only files that have suffix .cbl are passed to the compiler.
Nested programs: Multithreaded programs on the mainframe must be recursive. Therefore, avoid coding nested programs if you intend to port your programs to the mainframe and enable them to run in a multithreaded environment.