z/OS Language Environment Writing Interlanguage Communication Applications
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Array with #pragma

z/OS Language Environment Writing Interlanguage Communication Applications
SA38-0684-00

Sample C usage COBOL subroutine
#pragma linkage(cobrtn,COBOL)
#include <stdio.h>
void cobrtn (int array[2]);

int main()
{
  int array[2];
  array[0]=1;
  array[1]=2;
  cobrtn(array);
    /* array by reference */
}
IDENTIFICATION DIVISION.
PROGRAM-ID. COBRTN.
ENVIRONMENT DIVISION.
DATA DIVISION.
LINKAGE SECTION.
01 ARRAY.
    05 ELE PIC S9(9) BINARY OCCURS 2.
PROCEDURE DIVISION USING ARRAY.
    DISPLAY ELE(1) ELE(2)
    GOBACK.
END PROGRAM COBRTN.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014