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 > DB2 Plan Question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-09, 16:46
KevinYC KevinYC is offline
Registered User
 
Join Date: Aug 2008
Posts: 42
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!!
Reply With Quote
  #2 (permalink)  
Old 01-05-09, 17:21
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,195
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
Reply With Quote
  #3 (permalink)  
Old 01-05-09, 17:24
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,195
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
Reply With Quote
  #4 (permalink)  
Old 01-06-09, 12:00
KevinYC KevinYC is offline
Registered User
 
Join Date: Aug 2008
Posts: 42
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!
Reply With Quote
  #5 (permalink)  
Old 01-06-09, 13:38
KevinYC KevinYC is offline
Registered User
 
Join Date: Aug 2008
Posts: 42
i changed the 'owner' and it worked.
Thanks !
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