Writing code to run on the mainframe

You can use IBM COBOL for AIX to develop new applications, and take advantage of the productivity gains and increased flexibility of using your AIX workstation. However, when you develop COBOL programs, you need to avoid using features that are not supported by IBM mainframe COBOL.

Language features: COBOL for AIX supports several language features that are not supported by the IBM mainframe COBOL compilers. As you write code on the AIX workstation that is intended to run on the mainframe, avoid using these features:

Compiler options: Several compiler options are not available on the IBM mainframe compilers. Do not use any of the following compiler options in your source code if you intend to port the code to the mainframe:

File names: Be aware of the difference in file-naming conventions between AIX 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:

File suffixes: In COBOL for AIX, 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.