What is Metal C?

Metal C is freestanding C programming that requires no runtime and can access system services directly. It generates HLASM assembly code that uses MVS linkage conventions, with no dependency on the Language Environment (LE) at run time. Use it as an alternative to HLASM or complement it seamlessly.

Is Metal C programming like C programming?

Metal C is a subset of the C language with extensions to allow working with the system without any fixed runtime dependencies. It supports the core C feature set and library, and extensions such as embedding assembly code into C, customizing function prolog and epilogs and managing your own stack.

When should you use inline assembly (ASM) in C and Metal C?

Regular C requires the Language Environment C runtime, and this runtime is not always available at assembly exits and at other times. Metal C allows mixing 32-bit and 64-bit functions, which are not allowed in Language Environment. Metal C provides AR mode support to allow access to extra storage in data spaces beyond the normal storage.

What are some issues with traditional HLASM systems programming?

Assembly is rated as the third most dreaded language in Stack Overflow's 2020 Developer Survey. Some issues are long development times (especially to find and resolve defects), lack of widespread skills and difficulty to train someone to learn it. Each hardware upgrade requires a manual rewrite or tune their assembly code to exploit the latest hardware features. However, you can develop your applications with Enterprise Metal C for z/OS once, and then recompile to optimize for new z/Architecture systems.

When should I convert my ASM program to Metal C and when to another language?

Convert to Metal C if Language Environment is not available or you're accessing a system interface that's available in assembly only or require access to modules in MVS linkage. Otherwise, convert to an Language Environment-enabled language such as C/C++.

Do I need access to the Language Environment at run time?

No. Metal C generated code is designed to be Language Environment independent, though it can be used with Language Environment-enabled code if needed.

What is included with Enterprise Metal C?

A C compiler and a set of utilities for C application development.

Do I need to provide my own C libraries?

IBM supplies some C runtime library functions for programs that need them. This subset includes commonly used basic functions such as malloc(), memcpy(), and sscanf().

Can I use Metal C and HLASM together?

Yes. Metal C uses MVS linkage conventions. This allows for transitioning a program from HLASM incrementally or adding new functions to existing HLASM applications.

Do I have to modify my Metal C code to take advantage of new hardware?

No code modification is required. Metal C optimizes code automatically when recompiled with a new ARCH option.

Can Metal C generate assembly that performs as well as hand-written ones?

The compiler generates code that takes advantage of deep processor knowledge (such as instruction latency and throughput) and optimization techniques such as auto-vectorization, inlining, and outlining.

How does Metal C work?

See a flow diagram of how Metal C works at the link.

What AMODEs are supported?

AMODE 31, AMODE 64, and mixed AMODE programming.

Are data spaces supported?

Yes. Metal C supports AR-mode programming for both 31 and 64-bit AMODEs.

Can I inspect the automatically generated assembly code that is produced by Metal C?

Yes. Metal C generates HLASM format assembly (source) code, which can be viewed and edited just like any other assembly code. It also inlines the C statements as comments to make it easier to understand the HLASM code.