Fixed-length decimal data with #pragma


Sample COBOL usage C function
IDENTIFICATION DIVISION.
PROGRAM-ID.  COBRTN.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC 999V99 COMP-3.
PROCEDURE DIVISION.
    MOVE 123.45 TO X.
* X BY REFERENCE ***
    CALL "CENTRY" USING X.
    GOBACK.
END PROGRAM COBRTN.
#pragma linkage (centry,COBOL)
#include <stdio.h>
#include <decimal.h>

void centry (decimal(5,2) x)
{
  printf("%D(5,2)\n",x);
  return;
}