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 42509 from Cobol program

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-04-10, 22:06
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
sqlstate 42509 from Cobol program

A Cobol program that was converted from DB2/zOS to DB2/Linux is receiving sqlstate 42509. The program uses declared global temp tables. It does not get this sqlstate on DB2/zOS. It's believed this sqlstate is returned when the program tries to issue a drop table statement for a declared global temp table.

Any ideas what the problem might be?
Reply With Quote
  #2 (permalink)  
Old 11-05-10, 07:52
dr_te_z dr_te_z is offline
Registered User
 
Join Date: Jan 2009
Location: Zoetermeer, Holland
Posts: 555
mainframe cobol with embedded SQL to linux? Which cobol compiler? Do you pre-compile with db2prep? Is db2 also converted to LUW on linux? Which SQL block results in the error?
Reply With Quote
  #3 (permalink)  
Old 11-05-10, 08:09
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
I only know the answer to some of your questions. DB2 was also converted to LUW on Linux. Code provided to me is in the attached file.
Attached Files
File Type: txt cobol-2.txt (376 Bytes, 37 views)

Last edited by db2girl; 11-05-10 at 08:14.
Reply With Quote
  #4 (permalink)  
Old 11-05-10, 08:59
Alex JP Alex JP is offline
Registered User
 
Join Date: Oct 2010
Posts: 6
Bella,

Could you check what option you are using for the DYNAMICRULES clause in the bind statement? The bind should have DYNAMICRULES RUN specified, if not, could you rebind with the RUN option and retest the program.

Check out the manual for SQL0549N and the general rules for the DROP statement under Database reference->SQL->Statements.

Hope this helps

Alex
Reply With Quote
  #5 (permalink)  
Old 11-05-10, 15:37
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
Thank you. Changing to DYNAMICRULES RUN worked.


I see the same restrictions for the DROP statement in the LUW and zOS manuals:

LUW:
This statement can be embedded in an application program or issued through the use of dynamic SQL statements.
It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is in effect for the package (SQLSTATE 42509).


zOS:
This statement can be embedded in an application program or issued interactively.
It is an executable statement that can be dynamically prepared only if DYNAMICRULES run behavior is implicitly or explicitly specified.




The information in Table 1 looks the same to me:

LUW:
IBM DB2 9.7 for Linux, UNIX and Windows Information Center

zOS:
IBM Information Management Software for z/OS Solutions Information Center


I'm not sure why they were not getting this sqlstate on the mainframe IF using the same DYNAMICRULES (BIND was originally used) option. Do you know?


This is way outside of my area so it was a good learning experience.

Last edited by db2girl; 11-05-10 at 15:44.
Reply With Quote
  #6 (permalink)  
Old 11-05-10, 16:22
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by db2girl View Post
I'm not sure why they were not getting this sqlstate on the mainframe IF using the same DYNAMICRULES (BIND was originally used) option. Do you know?
One explanation could be that they bind and run the packages using the same authid.
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