MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

IMS application in C, accessing DB2

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS
View previous topic :: View next topic  
Author Message
gdenunzio
Beginner


Joined: 28 Oct 2003
Posts: 12
Topics: 5

PostPosted: Tue Oct 28, 2003 2:32 pm    Post subject: IMS application in C, accessing DB2 Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12365
Topics: 75
Location: San Jose

PostPosted: Tue Oct 28, 2003 3:04 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
gdenunzio
Beginner


Joined: 28 Oct 2003
Posts: 12
Topics: 5

PostPosted: Wed Oct 29, 2003 7:43 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> IMS All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group