Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    55

    Unanswered: DB2 Plan Question

    Hello,

    I am creating a new cobol program which accesses a DB2 table. I am using an old plan which is no longer used by any program. Is this OK? Are plans table-specific? Does each plan include unique access information for specific tables only?

    In other words, do i need to find a plan that includes accesses infomation for the table that my program needs? I am asking because i get compile errors regarding the fetch statement. I am wondering if the table used in the program is not included in the plan??


    EXEC SQL
    FETCH CUR_PMTYR
    INTO : DCLADVTB950.YRGIVING
    END-EXEC.


    Errors:
    UNDEFINED OR UNUSABLE HOST VARIABLE "DCLADVTB950".

    UNDEFINED OR UNUSABLE HOST VARIABLE "YRGIVING".

    THE OPEN STATEMENT FOR CURSOR 'CUR_PMTYR' IS INVALID BECAUSE THE CURSOR WAS DEFINED BY AN ALLOCATE CURSOR STATEMENT.

    Thanks much in advance!!

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    A plan is not predefined for any specific objects, so I don't think that is your problem. You will need to post the structure from working storage that you are referencing in the SQL. You also need to post the DDL for the table.

    I have never seen a space between the ":" and the variable name, but I suppose that is not the problem?
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    Quote Originally Posted by KevinYC
    THE OPEN STATEMENT FOR CURSOR 'CUR_PMTYR' IS INVALID BECAUSE THE CURSOR WAS DEFINED BY AN ALLOCATE CURSOR STATEMENT.
    Looks like we need to see the declare cursor and the open statement for this error.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  4. #4
    Join Date
    Aug 2008
    Posts
    55
    Marcus,

    Thank you for your response. My declare cursor statement didn't start in the right column. I have fixed that and the program has compiled. But I am getting a bind error:


    BIND PLAN(ADS0281) MEMBER(AFMYPFY1) OWNER(@DSND267)
    VALIDATE(BIND) EXPLAIN(YES)
    DSNT212I - BIND AUTHORIZATION ID @DSND267 IN THE OWNER KEYWORD
    IS INVALID
    DSNT201I - BIND FOR PLAN ADS0281 NOT SUCCESSFUL


    What does this generally mean? Did I use the wrong Owner? How do I knwo what the right Owner is?

    Thanks again!

  5. #5
    Join Date
    Aug 2008
    Posts
    55
    i changed the 'owner' and it worked.
    Thanks !

Posting Permissions

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