Object Rexx and DB2 
Author Message
 Object Rexx and DB2

Hi !

How do I invoke a query on a DB2 table using Object Rexx?

On the mainframe, you did CALL SQLEXEC. There's nothing in the
documentation.

I want to "select * from job_table where job_code = 1". I also want to
test sqlcode as well.

Thanks in advance, Nicole:cool:

--
www.MainFrameForum.com - USENET Gateway



Mon, 11 Apr 2005 06:09:19 GMT  
 Object Rexx and DB2
If you are on Win32 or other Intel platforms, running something like the DB2 SDK or DB2 CAE against DB2 Common Server then you have two choices, the DLL for Rexx that comes with the DB2 client, or Mark Hessling's RexxSQL package.

You can review the history of comp.lang.rexx (such as over at google.com) where this topic has been covered in the past - the two products compared, etc... and of course ask questions.

There is also a class library wrapping RexxSQL, I believe Mark has a link to this at his web site. I'm getting up to speed with the classes - really handy code!

--
Michael Lueck
Lueck Data Systems

Remove the upper case letters NOSPAM to contact me directly.



Mon, 11 Apr 2005 08:25:03 GMT  
 Object Rexx and DB2
Same for WIndows, but you have to register SQLEXEC first. Documentation is
with DB2.


Quote:
> Hi !

> How do I invoke a query on a DB2 table using Object Rexx?

> On the mainframe, you did CALL SQLEXEC. There's nothing in the
> documentation.

> I want to "select * from job_table where job_code = 1". I also want to
> test sqlcode as well.

> Thanks in advance, Nicole:cool:

> --
> www.MainFrameForum.com - USENET Gateway



Tue, 12 Apr 2005 16:01:50 GMT  
 Object Rexx and DB2
Nicole schrieb:

Quote:

> Hi !

> How do I invoke a query on a DB2 table using Object Rexx?

> On the mainframe, you did CALL SQLEXEC. There's nothing in the
> documentation.

> I want to "select * from job_table where job_code = 1". I also want to
> test sqlcode as well.

> Thanks in advance, Nicole:cool:

> --
> www.MainFrameForum.com - USENET Gateway

Hi Nicole,
here are some snippets from my PC (based on IBM DB2 Pers.Edition v7.1
and IBM OORexx v2.1.1):

if RxFuncQuery('SQLDBS') <> 0 then
   rcy = RxFuncAdd('SQLDBS','db2ar','SQLDBS')
if RxFuncQuery('SQLEXEC') <> 0 then
   rcy = RxFuncAdd('SQLEXEC','db2ar','SQLEXEC')
cmd_line = 'INSTALL SIGNAL HANDLER'
call SQLDBS cmd_line
if sqlca.sqlcode <> 0 then call sqlmessage cmd_line

call SQLEXEC 'connect  reset'
call SQLEXEC 'connect to TEST01'
call SQLMESSAGE 'Connect'

...some coding to call the classes

call SQLEXEC 'connect  reset'
call SQLMESSAGE 'Connect Reset'

exit   /* leave program */

/* *************************** SQLMESSAGE ************************** */
SQLMESSAGE:
arg errloc

if ( SQLCA.SQLCODE = 0 ) then
   return 0
else do
   say '--- error report ---'
   say 'ERROR occurred :' errloc
   say 'SQLCODE :' SQLCA.SQLCODE
/*********************\
* GET ERROR MESSAGE  *
\*********************/
   call SQLDBS 'GET MESSAGE INTO :errmsg LINEWIDTH 80'
   say errmsg
   say '--- end error report ---'

   if (SQLCA.SQLCODE < 0 ) then
      exit
   else do
      say 'WARNING - CONTINUING PROGRAM WITH ERRORS'
      return 0
   end
end
return 0

/* ========================= Requirements =========================== */
::requires "OODWIN32.CLS"  /* This file contains the OODIALOG classes */
::requires "WINSYSTM.CLS"  /* This file contains the Windows classes  */

...

::method InitDialog

  /* Initialization Code (e.g. fill list and combo boxes) */
  Anzahl = 0
  wSQLCmd = "SELECT VERTRAG_NR, VERTRAG_ID, ID_ID ",
            "  FROM TST.VTVERTRAG ",
            " ORDER BY VERTRAG_NR, VERTRAG_ID ",
            "   FOR FETCH ONLY  "
  call SQLEXEC "PREPARE S1 FROM :wSQLCmd"
  call SQLEXEC "DECLARE C1 CURSOR FOR S1"
  call SQLEXEC "OPEN C1"
  wFetch = "FETCH c1 INTO :wVertrag_Nr, :wVertrag_ID, :wID_ID"
  do forever
     call SQLEXEC wFetch
     if sqlca.sqlcode = 100 then leave
     Anzahl = Anzahl + 1
     curList~AddRow(,,wVertrag_NR,wVertrag_ID,wID_ID)
  end
  call SQLEXEC "CLOSE C1"

...

HTH and good luck

--
Manfred Niendiek                  Fon: +49 4461 / 93 11-0
Unternehmensberatung              Fax: +49 4461 / 93 11-32
Schlosserstrasse 45               Web: www.mniendiek.de



Wed, 13 Apr 2005 23:49:47 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Object Rexx and DB2 Server for NT

2. Problem of connection DB2 with Object REXX

3. Object REXX for AIX and DB2

4. Object Rexx access to DB2 universal database

5. DB2 and Object REXX on NT Alpha?

6. REXX/DB2 = COBOL/DB2 ???

7. REXX for CICS/ESA and DB2 REXX interface

8. Porting from REXX on VM to Object REXX on AIX or W2000

9. for help about vispro rexx and Object REXX

10. Object REXX: incompatibility with T-REXX ?

11. OS/2 Rexx port to Object Rexx for NT

12. OS/2 Rexx port to Object Rexx for NT

 

 
Powered by phpBB® Forum Software