If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQLSTATE 7003 in accessing DB2 record in a JCL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-23-11, 14:09
Rossini Rossini is offline
Registered User
 
Join Date: Jun 2011
Location: Philippines
Posts: 2
SQLSTATE 7003 in accessing DB2 record in a JCL

Hi,

Hope someone could help me with this one. I am a newbie in terms of JCL that will access DB2 records. I have posted my query in this category as the error I am getting is from database access.

I have created a JCL that will perform a SELECT statement and it will store the result in a dataset. There were no error in the JCL syntax (I think, cause RC=0 whenever I put a TYPRUN=SCAN), but my job will always return a code of 8 because of an SQLCODE = -518 and SQLSTATE = 7003.

I have tried searching the web for its meaning and got the following description -
The statement identified in the EXECUTE statement is a select-statement, or is not in a prepared state.

Can anyone please explain to me this description in Layman's term.

Many thanks.
Reply With Quote
  #2 (permalink)  
Old 06-23-11, 14:34
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
The error is in the 17th position on line 8.
Reply With Quote
  #3 (permalink)  
Old 06-23-11, 14:46
Rossini Rossini is offline
Registered User
 
Join Date: Jun 2011
Location: Philippines
Posts: 2
SQLSTATE 7003 in accessing DB2 record in a JCL

Quote:
Originally Posted by n_i View Post
The error is in the 17th position on line 8.
but my query was a simple
Select * from DEVSQL3.SSITMPRC A
where A.ROG = 'RDAL'
and A.UPC_MANUF = 88010
and A.UPC_SALES = 20801
that happens to be in a Control card.
Reply With Quote
  #4 (permalink)  
Old 06-23-11, 16:01
MarkhamDBA MarkhamDBA is offline
Registered User
 
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
you did not mention what version of db2 it is, but for v9:

-518
THE EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT

Explanation
One of the following conditions exists:
The statement named in the EXECUTE statement has not been prepared.
The statement named in the EXECUTE statement identifies a SELECT, or ASSOCIATE LOCATORS statement
The statement named in the EXECUTE IMMEDIATE statement identifies a SELECT or ASSOCIATE LOCATORS statement.
System action
The statement cannot be processed.

Programmer response
Ensure that you prepare the statement prior to EXECUTE. Also, ensure that the statement you prepare is not a SELECT or VALUES INTO statement.

SQLSTATE
07003
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
Reply With Quote
  #5 (permalink)  
Old 06-24-11, 08:40
jsharon1248 jsharon1248 is offline
Registered User
 
Join Date: Apr 2007
Location: Chicago
Posts: 57
JCL does not SELECT records. JCL runs programs that issue SELECTs. What program are you running to issue the SELECT? If the program is DSNTIAUL, make sure you add PARM('SQL') to the RUN statement:
Code:
RUN PROGRAM(DSNTIAUL) PLAN(DSNTIAUL) PARM('SQL')
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On