View previous topic :: View next topic |
Author |
Message |
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Tue Jul 08, 2008 12:02 pm Post subject: SQL IN REXX |
|
|
Hi all,
I am trying to write a sql in rexx but its failing when I include the where condition
[code:1:58a32273de]
000100 /* REXX */
001000 /* THIS IS A DB2 REXX FOR FETCHING ROWS FROM A CURSOR*/
001010 /* TRACE I */
001100 PARSE ARG SSID
001110 SSID = DSNT
001120 TNAME = 'XXXXX'
001200 "SUBCOM DSNREXX"
001300 IF RC THEN
001400 S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')
001500 /* */
001600 /* CONNECT TO THE DB2 SUB-SYSTEM */
001700 /* */
001710 TRACE R
001800 ADDRESS DSNREXX "CONNECT" SSID
001900 IF SQLCODE _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
danm Intermediate
Joined: 29 Jun 2004 Posts: 170 Topics: 73
|
Posted: Tue Jul 08, 2008 1:28 pm Post subject: |
|
|
Try put single quote around TNAME:
Code: |
SQLSTMT = ,
"SELECT DBNAME",
"FROM SYSIBM.SYSTABLES WHERE NAME = '"TNAME"'"
|
|
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed Jul 09, 2008 12:18 am Post subject: |
|
|
Also, halt your processing once you find an error, then you will not be taking up resources trying to do things that will not work. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Wed Jul 09, 2008 12:56 am Post subject: |
|
|
Danm,
I got this error when I changed like that
[code:1:1304077915]
19 +++ SQLSTMT = ,
'SELECT DBNAME', '
FROM SYSIBM.SYSTABLES WHERE NAME = '"TNAME"'" /*
*/ /* DECLARE THE
CURSOR */ /*
*/ ADDRESS DSNREXX "EXECSQL DECL
ARE C1 CURSOR FOR S1" IF SQLCODE _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Wed Jul 09, 2008 7:55 am Post subject: |
|
|
Look at the usage of " and ' in the posting of Danm and change your statement accordingly. You didn't get it right.
regards
Christian |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Wed Jul 09, 2008 11:20 am Post subject: |
|
|
You appear to have extra quotes on your SELECT line as well. Use double quotes around your strings just to make things clearer. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
kingo Intermediate
Joined: 01 Sep 2006 Posts: 167 Topics: 40 Location: chennai
|
Posted: Wed Jul 09, 2008 10:23 pm Post subject: |
|
|
Oops sorry for that and I done it and the REXX is working fine
Thanks danm,CZerfas,Nic Clouston _________________ IF YOU ARE NOT FOCUSSED ON GOAL ALL YOU SEE IS OBSTACLE. |
|
Back to top |
|
|
|
|