Skill wise I am an OPM COBOL/400 programmer. Our shop does not use COBOL ILE at all so I am trying to figure out the approach. The ultimate goal is to eventually have a COBOL program that calls a C program that eventually goes out to a web service. For now, I am working on (as my original example was trying to explain poorly, I’m new) a proof of concept to create a COBOL ILE program call a C ILE procedure. I do not want to create a C program, just a C procedure. My COBOL ILE module has the following.
MOVE 8 TO WS-FIRST-COBOL-NUM
MOVE 9 TO WS-SECOND-COBOL-NUM
WS-FIRST-COBOL-NUM PIC S9(02).
WS-SECOND-COBOL-NUM PIC S9(02).
WS-NUM-TOTAL-COBOL PIC S9(02).
CALL PROCEDURE “SHARETEST3″ USING WS-FIRST-COBOL-NUM
Here is my C procedure logic:
void SHARETEST3(int num1, int num2, int total)
total = num1 + num2;
I put displays in the COBOL program:
DISPLAY ‘BEFORE CALL TO C ‘ WS-FIRST-COBOL-NUM
CALL PROCEDURE “TESTC” USING WS-FIRST-COBOL-NUM
DISPLAY ‘AFTER CALL TO C ‘ WS-FIRST-COBOL-NUM
The result is exactly the same before and after the call: 08*09*000
I thought that the argc and argv[ ] were only if you were to create a C ILE program. The C ILE procedure is how I am going to do this. I will create my COBOL ILE module, the C ILE module and then do CRTPGM to make a runnable object.
Also, ultimately I would need this calling chain – OPM COBOL calls ILE CRTGM object. so, this would be OPM COBOL ==> ILE CRTPGM (inside is the COBOL ILE mod and the C ILE mod). Is it possible to do this; calling an ILE program from an OPM COBOL?
To answer your questions Tom, I want a C procedure. I need the result in a returned value. On a side note I’d rather learn C but I primarily know COBOL. Because we will be trying, later on, to do web servcie calls, I need to do the COBOL to the C. I am with you on the learning curve. I’m learning ILE and C.
Thank you very much for your input. I have to see why that WS-NUM-TOTAL-COBOL is not working correctly.