Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2011
    Location
    Philippines
    Posts
    2

    Unanswered: 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.

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    The error is in the 17th position on line 8.

  3. #3
    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.

  4. #4
    Join Date
    Dec 2008
    Location
    Toronto, Canada
    Posts
    399
    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 9.5/9.7 on Unix/AIX 6.1/Linux

  5. #5
    Join Date
    Apr 2007
    Location
    Chicago
    Posts
    68
    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')

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •