Home > Mobile >  Sending data from C to COBOL on HP Tandem
Sending data from C to COBOL on HP Tandem

Time:09-28

I am trying to call C-program from COBOL and expecting reply from it. I am new to this interfacing.

*COBOL CODE
ENTER C "ADD" USING A,B.

/* C-PROGRAM */
int ADD(int a,int b)
{
   return a b;
}

I want to get the sum value from C-program for further processing in COBOL.

CodePudding user response:

In COBOL

EXTENDED-STORAGE SECTION.
01 MYVAR EXTERNAL.
   05 DATA-01 PIC X(20).

In C

 /*Add necessary includes */
 extern char MYVAR[21];

 void change_Cobol_Variable()
 {
   /*you can use MYVAR as normal C-variable*/
   sprintf(MYVAR, "%s","Something");
 }

If it is integer declare appropriate variables as per your need :)

  • Related