Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Prepare in EXECSQL through REXX return code -1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
sakrat

Active User


Joined: 05 Feb 2014
Posts: 159
Location: India

PostPosted: Fri Jun 12, 2015 5:34 pm    Post subject: Prepare in EXECSQL through REXX return code -1
Reply with quote

Hi,
I am trying to connect REXX with DB2 with the user's input in the front panel. I get (-1) return code for all the SQL statements. Please help me in correcting the error. As this is my first REXX code with DB2 i couldnt try solving this issue.

Code:


TRACE(I)
ADDRESS ISPEXEC
"ISPEXEC LIBDEF ISPPLIB DATASET ID('******') STACK"
"ISPEXEC DISPLAY PANEL(PANEL1)"
ADDRESS TSO
SRCSYS='***'
SRCSCHEMA = '******'
  IF STRIP(SRCSYS) <> '' THEN
    SSID = SRCSYS

  "DYNASTEP ADD DA('"SSID"GRP.ALIAS.SDSNLOAD')    BOTTOM NOMSG"
  "DYNASTEP ADD DA('"SSID"GRP.ALIAS.SDSNEXIT')    BOTTOM NOMSG"
  "DYNASTEP ADD DA('"SSID"GRP.ALIAS.RUNLIB.LOAD') BOTTOM NOMSG"

ADDRESS TSO "SUBCOM DSNREXX"
  IF RC THEN
     S_RC=RXSUBCOM('ADD','DSNREXX','DSNREXX')

ADDRESS DSNREXX "CONNECT" SRCSYS
  IF SQLCODE <> 0 THEN SAY "CON" SQLCODE CALL SQLCA

QUERY='SELECT * FROM '''SRCSCHEMA'''.'''SRCTABLE''' '

ADDRESS DSNREXX "EXECSQL PREPARE S1 FROM :QUERY"
  IF SQLCODE <> 0 THEN SAY "DEC" SQLCODE CALL SQLCA

ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1"
  IF SQLCODE <> 0 THEN SAY "PRE" SQLCODE CALL SQLCA

ADDRESS DSNREXX "EXECSQL OPEN C1"
  IF SQLCODE <> 0 THEN SAY "OPN" SQLCODE CALL SQLCA

   
SQLCA:
SAY "SQLCODE:  ==>" SQLCODE
        ADDRESS DSNREXX  DISCONNECT
        S_RC = RXSUBCOM( 'ADD','DSNREXX','DSNREXX')
        EXIT


Below is my TRACE output :

Code:


 *-* ADDRESS TSO "SUBCOM DSNREXX"
 >L>   "SUBCOM DSNREXX"
 *-* IF RC
 >V>   "0"
 *-* ADDRESS DSNREXX "CONNECT" SRCSYS
 >L>   "CONNECT"
 >V>   "***"
 >O>   "CONNECT ***"
 *-* IF SQLCODE <> 0
 >V>   "0"
 >L>   "0"
 >O>   "0"
*-* QUERY='SELECT * FROM '''SRCSCHEMA'''.'''SRCTABLE''' '
>L>   "SELECT * FROM '"
>V>   "*****"
>O>   "SELECT * FROM *****"
>L>   "'.'"
>O>   "SELECT * FROM 'RERET05'.'"
>V>   "NZDEBTP"
>O>   "SELECT * FROM ****.*****"
>L>   "' "
>O>   "SELECT * FROM *****.*****"
*-* ADDRESS DSNREXX "EXECSQL PREPARE S1 FROM :QUERY"
>L>   "EXECSQL PREPARE S1 FROM :QUERY"
+++ RC(-1) +++
*-* IF SQLCODE <> 0
>V>   "-104"
>L>   "0"
>O>   "1"
*-*  THEN
*-*  SAY "DEC" SQLCODE CALL SQLCA
>L>    "DEC"
>V>    "-104"
>O>    "DEC -104"
>L>    "CALL"
   >O>    "DEC -104 CALL"
   >L>    "SQLCA"
   >O>    "DEC -104 CALL SQLCA"
-104 CALL SQLCA
24 *-* ADDRESS DSNREXX "EXECSQL DECLARE C1 CURSOR FOR S1"
   >L>   "EXECSQL DECLARE C1 CURSOR FOR S1"
25 *-* IF SQLCODE <> 0
   >V>   "0"
   >L>   "0"
   >O>   "0"
27 *-* ADDRESS DSNREXX "EXECSQL OPEN C1"
   >L>   "EXECSQL OPEN C1"
   +++ RC(-1) +++
28 *-* IF SQLCODE <> 0
   >V>   "-514"
   >L>   "0"
   >O>   "1"
   *-*  THEN
   *-*  SAY "OPN" SQLCODE CALL SQLCA
   >L>    "OPN"
   >V>    "-514"
   >O>    "OPN -514"
   >L>    "CALL"
      >O>    "OPN -514 CALL"
      >L>    "SQLCA"
      >O>    "OPN -514 CALL SQLCA"
PN -514 CALL SQLCA 
   
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Fri Jun 12, 2015 6:28 pm    Post subject: Reply to: Prepare in EXECSQL through REXX return code -1
Reply with quote

the return code is a generic error...
You received a -104 and a -514 sqlcode
look at the manual and fix them
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts EXIT or RETURN cvnlynn CLIST & REXX 16 Wed Jul 19, 2017 2:50 am
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us