MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with rexx Stored procedure

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF
View previous topic :: View next topic  
Author Message
ssd
Beginner


Joined: 24 Mar 2006
Posts: 25
Topics: 10

PostPosted: Thu Jul 26, 2007 9:48 am    Post subject: Help with rexx Stored procedure Reply with quote

I am trying to call a rexx stored procedure using a rexx exec but it is failing with -471 sqlcode. Can anybody help me resolve this

Rexx exec:
Code:

address tso "STEPLIB DA('TDB2.SDSNEXIT','TDB2.SDSNLOAD') SHR"
address sql                                                 
address tso "SUBCOM DSNREXX"                                 
if rc then                                                   
   do                                                       
   s_rc = RXSUBCOM('ADD','DSNREXX','DSNREXX')               
   end                                                       
ADDRESS DSNREXX 'CONNECT' TdB2                               
                                                             
PARM1 = ' '                                                 
PARM2 = ' '                                                 
                                                             
ADDRESS DSNREXX "EXECSQL ",                                 
                "CALL TGRPWORK.MIGSP001 ( ",                 
                " :PARM1, :PARM2 ) "                         
                                                             
SAY SQLCODE                                                 

EXIT(0)

Rexx Stored procedure:
arg input                                                   
                                                             
address tso "STEPLIB DA('TDB2.SDSNEXIT','TDB2.SDSNLOAD') SHR"
address sql                                                 
address tso "SUBCOM DSNREXX"                                 
if     rc then                                               
  do                                                         
  s_rc = RXSUBCOM('ADD','DSNREXX','DSNREXX')                 
  end                                                       
 ADDRESS     DSNREXX 'CONNECT' TdB2                         
                                                             
 creator_name='TDB2PIIX'                                     
 table_name='MMST_MSG_FRMT_STRC'                             
 table_name='MSWT_MSG_SSCR'                                 
                                                             
 s1 = " SELECT COLNAME,COLNO"                               
 s2 = " FROM SYSIBM.SYSINDEXES I,SYSIBM.SYSKEYS K"           
 s3 = " WHERE TBNAME = '"table_name"'"                       
 s4 = " AND I.TBCREATOR = '"creator_name"'"       
 s5 = " AND K.IXCREATOR = '"creator_name"'"       
 s6 = " AND I.UNIQUERULE = 'P'"                   
 s7 = " AND K.IXNAME = I.NAME"                     
                                                   
 SQLSTMT = s1||s2||s3||s4||s5||s6||s7             
                                                   
address dsnrexx "EXECSQL DECLARE C1 CURSOR FOR S1"
address dsnrexx "EXECSQL PREPARE S1 FROM :SQLSTMT"
address dsnrexx "EXECSQL OPEN C1"                 
                                                   
Exit(0)
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu Jul 26, 2007 10:03 am    Post subject: Reply with quote

ssd,

Read Chapter 12 in this redbook

http://www.redbooks.ibm.com/redbooks/pdfs/sg247083.pdf

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> TSO and ISPF All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group