View previous topic :: View next topic
|
Author |
Message |
amitava Warnings : 1 Active User

Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
Hi All,
Please can you send me a REXX routine embedded with DB2. I mean I want to write a REXX routine that will connect with DB2 and then from a table it will fetch the data and show it on a panel or by 'SAY' coomand in REXX. |
|
Back to top |
|
 |
ofer71
Global Moderator

Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Sorry, I can't send you code, but you can find all the information you need in the fine manual.
O. |
|
Back to top |
|
 |
antonrino.b
New User

Joined: 10 Jan 2006 Posts: 76 Location: Germany
|
|
|
|
/* REXX */
S_RC=RXSUBCOM('ADD','DSNREXX','DSNREXX')
ADDRESS DSNREXX "CONNECT ZZZZ"
QUERY= 'SELECT name, address FROM table1 where',
'empno = 100001 '
ADDRESS DSNREXX 'EXECSQL PREPARE S1 FROM :QUERY'
ADDRESS DSNREXX 'EXECSQL DECLARE C1 CURSOR FOR S1'
ADDRESS DSNREXX 'EXECSQL OPEN C1'
ADDRESS DSNREXX 'EXECSQL FETCH C1 INTO :name,:address'
IF SQLCODE = 0 THEN
do
SAY 'name : ' name
SAY 'addresss:' address
end
ELSE
SAY 'DB2 ERROR'
ADDRESS DSNREXX "DISCONNECT"
Hope this would be useful for you..
ZZZZ is the database name |
|
Back to top |
|
 |
amitava Warnings : 1 Active User

Joined: 30 Oct 2005 Posts: 186 Location: India
|
|
|
|
Thanx antonrino. Thanx a lot. |
|
Back to top |
|
 |
|