Call COBOL from C dynamically...
All, I have a C-Prog and a COBOL-Prog and I want to "call" the COBOL-Prog from C - but dynamically! Like: int main() { printf("Calling famous COBOL...\n"); COBPROG(); printf("Ahhh, back again ;)\n"); } So, what happens is that the linker includes the Load-Module of COBPROG into the Load-Module of my C-Prog. Somehow possible to avaoid this? Thank you, Michael -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
Re: Call COBOL from C dynamically...
Hi Michael, This can be accomplished by using the fetch() c run-time library function. Check the z/OS C/C++ Run-Time Library Referance book, It contains an elaborate example of calling a COBOL program using fetch(). Gil. On 6/29/05, Michael Knigge <[EMAIL PROTECTED]> wrote: > I have a C-Prog and a COBOL-Prog and I want to "call" the COBOL-Prog > from C - but dynamically! -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
Re: Call COBOL from C dynamically...
Gil Peleg schrieb: This can be accomplished by using the fetch() c run-time library function. Check the z/OS C/C++ Run-Time Library Referance book, It contains an elaborate example of calling a COBOL program using fetch(). Thanks I've tried it works well ;-) Bye Michael -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html
Re: Call COBOL from C dynamically...
>This can be accomplished by using the fetch() c run-time library function. >Check the z/OS C/C++ Run-Time Library Referance book, It contains an >elaborate example of calling a COBOL program using fetch(). > Gil. Just a caveat on something that might not be explicit from the documentation nor the samples: if the dynamic call is in a loop, you should avoid to fetch and release the called module within the loop. This is just common sense, I know; good programming practice requires that you initialize things at the beginning, use those things within the loop and then clean up at the end of the program. But in this case, it is even more important, because, depending on how the called module is structured and what it does in terms of calling other modules and particularly DLLs, all sorts of strange side-effects may occur. Cheers, Jantje. -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html