IMS application in C, accessing DB2
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> IMS

#1: IMS application in C, accessing DB2 Author: gdenunzio PostPosted: Tue Oct 28, 2003 2:32 pm
    —
Hi all!
After some learning in the IMS world (just the basics, so I can go on experimenting with application programming), I am now trying to write a transaction, coded in the C language, which uses SQL to talk to DB2.

The manual says that I have to insert this line in my code:

#pragma runopts(env(ims),plist(os))

but this causes some problems: #pragma runopts must be put at the very beginning of a source file, before any C instruction, and this is what I do. But my source code is pre-digested by the SQL pre-compiler, which inserts a lot of SQL stuff at the start of the file. So #pragma runopts in practice finds itself after a lot of C lines automatically inserted, and the compiler says:

WARNING EDC0440 SYS97301.T195758.RA000.DB2IMSMK.DSNHOUT.H01:24 #pragma runopts must appear before any C code.

Even if this is just a warning, I imagine that means that my options will not be taken into consideration..?
Moreover, I am not finding the exact meaning of that message (beside the obvious).

Any help? Any C source code which calls DB2?

Thanks!
Giorgio

#2:  Author: kolusuLocation: San Jose PostPosted: Tue Oct 28, 2003 3:04 pm
    —
Giorgio,


Check the following link for C/C++ program examples using DB2.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCPG130/6.4?DT=20020617144629

Check the following link for C/C++ program examples using IMS.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCPG130/6.6?DT=20020617144629

Check this link for z/OS V1R4.0 C/C++ Programming Guide.

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCPG130/CCONTENTS?DT=20020617144629

Hope this helps...

cheers

kolusu

#3:  Author: gdenunzio PostPosted: Wed Oct 29, 2003 7:43 am
    —
Hi Kolusu!
Thanks for your kind reply!
I had already looked at that documentation (for older MVS/IMS/DB2 versions, so perhaps now it contains something more: I'll check that) but it did not solve my problem. Anyway, I now have a solution, more or less...
I resume; my source is split in three parts (in three different sources): main, doims, dosql. "Main" contains the ims runopt stuff, and calls the other two parts. Now, I simply don't let "main" pass through the SQL preprocessor (only dosql needs it). I do all steps separately (sql preprocessor only when needed, compiler, prelinker for all the objects together, linker) and all is working fine (at least as far as program preparation is concerned: now I have to see if DB2 calling works!!).
Of course I'd like to know if a more elegant solution, valid for a single-source program, exists.
Another (small) problem I have now is to see how I say to IMS that it has to reload the application program linked to a transaction, when I change this program: it is evident that IMS loads somewhere a copy of the module, so re-compiling it is not enough: I have to explicitly invalid the old copy and make ims accept the new one.
Thanks!
Giorgio



MVSFORUMS.com -> IMS


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group