z/OS - Group home

z/OS Application Modernization with IBM Metal C

By John Parke posted Tue November 30, 2021 02:07 PM


z/OS Application Modernization with IBM Metal C

The IBM z/OS XL C/C++® compiler has an option referred to as METAL C. This option generates IBM high level assembler (HLASM) code instead of an object module. The advantage of using this option is that the generated code does not depend on Language Environment® support at runtime; although it may require the Metal C runtime library (in LPA). METAL C allows the use of embedded system service calls: STORAGE OBTAIN, OBTAIN macro, CATLOG/CAMLST, etc. Routines can be created using METAL C, and then called from an assembler or high-level language program. Metal C uses standard MVS linkage conventions.

IBM suggests that Metal C can be used to write system exits. It is also noted that Metal C environments are intended to be used serially by a single dispatchable unit of work.

The downside to using the Metal C option is that very few of the C library routines are available and no I/O is provided. Even without the C library functions, Metal C can still be a useful tool.

When I got started using the Metal C option, I made a lot of mistakes, as the documentation seemed unclear to me. I thought that I would share some of what I have learned in case anyone else was interested in what can be done with Metal C and with the hope that others will share their ideas. In that regard I created a website which discusses how to develop using Metal C. See below for URL.

Application Modernization

Using Metal C allowed me to port all types of open-source software to the z/OS environment, saving a considerable amount of development time, in improving application functionality. Besides providing code modernization, it provides performance modernization due to the optimization techniques, such as instruction scheduling, employed by the compiler.

Metal C Features

Some of the features of the Metal C option include:

  • Generates code that is independent of LE.
  • Code follows standard MVS linkage conventions.
  • Uses a stack for dynamic storage area (DSA). Use of NAB (Next Available Byte), reduces storage obtains and frees.
  • Compiler generates optimized code that takes advantage of instruction scheduling, high-order loop analysis and transformations (HOT), and loop unrolling.
  • Provides support for embedding assembler instructions in the compiler generated code.
  • AR mode programming support
  • long name support for external names of mixed case and up to 1024 characters long.

I have created a web site that gives an overview and introduction to the Metal C compiler, along with discussions of how to use the product. There are also ten example C programs that can be downloaded as a zip file. These can be compiled with the Metal C compiler.

The web site is:


John Parke

Alebra Technologies Inc.