These call conventions are relevant to .NET managed code when using Platform Invoke only to call unmanaged code.
COBOL programs can call and be called by programs written in other languages. However, some languages handle calls differently from COBOL. For example, some language pass parameters in the opposite order from that expected by COBOL programs. To enable COBOL and non-COBOL programs to call each other, you can adjust the calling mechanisms that the COBOL program uses or that it expects to be used.
To specify the calling mechanisms you require, you first construct the call convention number that produces the required mechanisms. The call convention number is a 16-bit number defined as follows:
When you have constructed the call convention number, you convert it to a decimal number, and then assign this decimal number to a name, by defining it the Special Names paragraph. You then use the call convention name in the CALL statement.
For example, if you define the following call conventions:
SPECIAL-NAMES. CALL-CONVENTION 0 IS Microsoft-c CALL-CONVENTION 3 IS Pascal.
you can then use one convention when calling a C program as follows:
CALL Microsoft-c "routine-name" USING parameter-1,parameter-2
and use the other convention when receiving a call from a Pascal program, such as:
PROCEDURE DIVISION Pascal USING parameter-1,parameter-2
If you do not specify a call convention, the standard COBOL convention (call-convention 0) is assumed, unless the DEFAULTCALLS Compiler directive is used.