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 

error while executing Dynamic SQL

 
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: Sun Apr 15, 2007 11:33 pm    Post subject: error while executing Dynamic SQL Reply with quote

I am trying to execute a dynamic SQL in REXX using DSNREXX environment . But I am encountering -199 SQLCODE while preparing the statement. The following is the piece of code that I am using. Pls help me resolving this.
Code:

S2 = "EXECSQL ",                                                 
           " SELECT '1' ",                                       
           " INTO :COLCHK",                                     
           " FROM SYSIBM.SYSCOLUMNS ",                           
           " WHERE ",                                           
           "      NAME      = '"COLNAME"'",                     
           "  AND TBNAME    = '"PTABLE.CNT"'",                   
           "  AND TBCREATOR = '"creator_name"'"                 
SQLSTMT2 = S2                                                   
                                                                 
address  dsnrexx "EXECSQL PREPARE S2 INTO :SQLDA  FROM :SQLSTMT2"
SAY SQLCODE
Back to top
View user's profile Send private message
ofer71
Intermediate


Joined: 12 Feb 2003
Posts: 358
Topics: 4
Location: Israel

PostPosted: Mon Apr 16, 2007 4:42 am    Post subject: Reply with quote

This is a syntax error. Use TRACE to display the generated SQL statement; also, display SQLERRM to see some more info.

O.
________
grape ape pictures


Last edited by ofer71 on Sat Feb 05, 2011 11:59 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
ssd
Beginner


Joined: 24 Mar 2006
Posts: 25
Topics: 10

PostPosted: Mon Apr 23, 2007 7:28 am    Post subject: Reply with quote

I used a cursor to execute the query. now it works

Thanks
ssd
Back to top
View user's profile Send private message
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