here is my problem. i am very new to mainframes. so bare with me.
i need to call a cobol+db2 program from a c program. my problem is not in calling. i am able to perfectly compile and run the program. but the "EXEC SQL" statements in cobol program are completely ingnored. all other statements alone execute. i dont know how to make sql statements execute. please help me.
here is my c code.
#pragma linkage(COB1,COBOL)
#include<stdio.h>
void COB1(int *);
int main()
{
int c;
c=10;
COB1(&c);
printf("%d\n",c);
return 0;
}
my cobol code:
IDENTIFICATION DIVISION.
PROGRAM-ID. COB1.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL INCLUDE SQLCA END-EXEC.
EXEC SQL INCLUDE DCL END-EXEC.
EXEC SQL DECLARE CUR CURSOR FOR SELECT * FROM TAB1
END-EXEC.
LINKAGE SECTION.
01 X PIC S9(9) USAGE BINARY.
PROCEDURE DIVISION USING BY REFERENCE X.
EXEC SQL OPEN CUR END-EXEC.
EXEC SQL FETCH CUR INTO :EMP END-EXEC.
DISPLAY EMP.
COMPUTE X = X + EMP.
DISPLAY X.
GOBACK.
the output from cobol
000000000
000000010
here tab1 is a table with one column as EMP with one row with value 70. so for the first display statement i should be getting 70 instead of 0 and for the second one 80. please help me.