Page 1 of 1

REXX- delete query in REXX

PostPosted: Thu Jun 28, 2012 1:04 pm
by pshongal
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"

Re: REXX- delete query in REXX

PostPosted: Thu Jun 28, 2012 3:21 pm
by Akatsukami
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?

Re: REXX- delete query in REXX

PostPosted: Thu Jun 28, 2012 3:30 pm
by pshongal
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... :)

Re: REXX- delete query in REXX

PostPosted: Thu Jun 28, 2012 6:00 pm
by NicC
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.

Re: REXX- delete query in REXX

PostPosted: Thu Jun 28, 2012 8:54 pm
by dick scherrer
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