IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

REXX- delete query in REXX


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Thu Jun 28, 2012 3:27 pm
Reply with quote

pshongal wrote:
Hi Gnana Sekaran.

I infact removed that condition itself.

Code:
QUERYSQL = "DELETE FROM table_name WHERE"||,
"ac_num = '"||AC1||"';"

Still same result.

So, what you're passing to DSNREXX is
Code:
DELETE FROM table_name WHEREac_num = 'AC1';

and you're puzzled as to why it doesn't work? icon_rolleyes.gif
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Thu Jun 28, 2012 3:33 pm
Reply with quote

Hi Akatsukami,
Thats right.
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Thu Jun 28, 2012 4:12 pm
Reply with quote

Code:
 
QUERYSQL = "DELETE FROM table_name WHERE"||,
"ac_num = '"||AC1||"';"

I assume the -104 comes from the table name concatenated with the word "WHERE".
So put in a blank or remove the silly || as in
Code:
 
QUERYSQL = "DELETE FROM table_name WHERE",
"ac_num = '"||AC1||"';"
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Thu Jun 28, 2012 5:16 pm
Reply with quote

Long thread for such a simple problem. icon_rolleyes.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Thu Jun 28, 2012 5:34 pm
Reply with quote

About your problem:
  • In addition to displaying the SQLCODE, you should as well display the SQLERRMC value.
    It will tell you which token is erroneous.
About your code:
  • The SUBCOM to CONNECT commands should be issued before displaying the panel.
    If there is a problem connecting to DB2, why let the user loose time in filling the panel.
  • That will not work:
    Quote:
    rexxvar="COMMIT"
    ADDRESS DSNREXX "EXECSQL rexxvar"
  • This is nice if you are paid by the line:
    Quote:
    If RC ¬= 0 Then
    Do
    exit
    End
    If not, you could just write "If RC ¬= 0 Then Exit"
About your post:
  • Use COPY/PASTE or double-check yourself!
    "WHERE" is missing from these lines:
    Quote:
    QUERYSQL = "DELETE FROM table_name"||,
    "ac_num = '"||AC1||"'"||" AND abc = NULL"
  • Learn to use BBCODE !
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 28, 2012 5:40 pm
Reply with quote

with any REXX script, use TRACE
before you annoy us with your Rookie BS.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jun 28, 2012 6:29 pm
Reply with quote

Where is the WHERE in your code?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jun 28, 2012 8:12 pm
Reply with quote

Whenever I write REXX + SQL programs I display the built query and copy that and try executing it in SPUFI

By doing that you could atleast ensure the syntax of SQL is correct

You have give the display but did you try to EXECUTE the displayed result in SPUFI
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 10:39 am
Reply with quote

Hi Nic,
Its typo, I have missed. I have given it in my query.

Hi Pandora-Box,
I did exactly the same way as you said using QMF. It does work.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Jun 29, 2012 10:42 am
Reply with quote

Is your rexx program working?

If yes , Moderators please lock it
Back to top
View user's profile Send private message
pshongal

New User


Joined: 14 Jun 2012
Posts: 96
Location: India

PostPosted: Fri Jun 29, 2012 12:08 pm
Reply with quote

Hi Pandora-Box,

REXX pgm is not working. But anyways.. I will try to dig more and try to find solution. If I find something, I will post the solution.

Thanks to all for your responce.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Jun 29, 2012 12:48 pm
Reply with quote

Do not re-type your code - cut and paste it. That way you stop people looking at rubbish introduced by your re-typing. Instead they can look at what you actually run. And you were asked some time ago to run with a trace and pst the results and you have shown no evidence of having done that.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Mon Jul 02, 2012 9:49 pm
Reply with quote

Quote:
I will try to dig more and try to find solution. If I find something, I will post the solution.


The problem was clearly identified already by other posters. And a recommended solution was also already posted. Re-read Akatsukami and Stefan's posts again.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2 Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts DELETE SPUFI DB2 1
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top