REXX- delete query in REXX



IBM's Command List programming language & Restructured Extended Executor

REXX- delete query in REXX

Postby pshongal » Thu Jun 28, 2012 1:04 pm

I would like to delete multiple rows in the DB2 table using REXX. I have given GU interface to enter a/c#s. Rexx pgm should delete those from DB. I have below rexx pgm. It ends normally when executed, row is not deleting. I am getting RC -1 and SQLCODE -104 when it reaches ADDRESS DSNREXX "EXECSQL EXECUTE IMMEDIATE S1" . I dont find any syntax error with SQL statement. What I have missed?

/*REXX*/                                                 
CLEAR                                                   
START:                                                   
USER = SYSVAR('SYSUID')                                 
"ISPEXEC LIBDEF ISPPLIB DATASET ID('ND2535A.INTL.TOOLS')"
"ISPEXEC DISPLAY PANEL(DELEMSCR)"                       
Message = ' '                                           
If RC ¬= 0 Then                                         
  Do                                                     
     exit                                               
  End                                                   
If RG = 'E1' Then                                       
   SSID = 'DB2D'                                         
Else                                                     
   SSID = 'DB2T'                                         
ADDRESS TSO "SUBCOM DSNREXX"                             
IF RC THEN                                               
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')               
ADDRESS DSNREXX "CONNECT "SSID
SAY 'RC1 'RC                                             
QUERYSQL = "DELETE FROM VMUSHE.REL_AD_USE WHERE "||,     
           "PARTY_REL_ACCT_ID='"||AC1||"';"             
rexxvar="COMMIT"                                         
                                                         
SAY 'DELETING 'AC1                                       
SAY QUERYSQL                                             
ADDRESS DSNREXX "EXECSQL PREPARE S1 FROM :QUERYSQL"     
SAY 'RC2 'RC                                             
ADDRESS DSNREXX "EXECSQL EXECUTE IMMEDIATE S1"           
SAY 'RC3 'RC                                             
SAY 'SQLCODE 'SQLCODE                                   
SAY 'SQLSTATE 'SQLSTATE                                 
IF SQLCODE = 0 THEN DO                                   
  ADDRESS DSNREXX "EXECSQL rexxvar"                     
  SAY 'ACCT DELETED SUCCESSFULLY'                       
ADDRESS DSNREXX "DISCONNECT"
pshongal
 
Posts: 2
Joined: Wed Jun 27, 2012 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX- delete query in REXX

Postby Akatsukami » Thu Jun 28, 2012 3:21 pm

Granting that your coding and question-asking skills are more suited to this board than the big boys' and girls' forum, what made you think (if I can use the word in this connection) that you'd get better answers by duplicating your post here?
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: REXX- delete query in REXX

Postby pshongal » Thu Jun 28, 2012 3:30 pm

Hi Akatsukami,

HOPE of getting some idea from a member who may not be there in other forum made me to post my question in this forum also... :)
pshongal
 
Posts: 2
Joined: Wed Jun 27, 2012 4:46 pm
Has thanked: 0 time
Been thanked: 0 time

Re: REXX- delete query in REXX

Postby NicC » Thu Jun 28, 2012 6:00 pm

And it still has not been posted with code-tags so is not easy to read. Also, still no trace to show what Rexx knows it has.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: REXX- delete query in REXX

Postby dick scherrer » Thu Jun 28, 2012 8:54 pm

HOPE of getting some idea from a member who may not be there in other forum made me to post my question in this forum also...
Other than beginners, the people who help and/or moderate here are the same "seniors" who support the other forum. It is a complete waste of time to multi-post the same question. Also, most of us participate in even more forums and when posts are duplicated there, they are usually locked or deleted in our forums.

This topic has been locked as it is a duplicate of the topic in our "main" forum.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post