Unanswered: calling stored procedure from cobol - bind error
I am trying to call a DB2 stored procedure from a cobol program. Up to this point, I have been calling them from ASP pages. I want to get this to work so that the host programmers can test the stored procedures on their own, in an environment thats comfortable.
I have found the correct syntax to make the call withing my cobol program.
We keep our stored procedures in a product called Endevor. I am a new programmer, and have only worked in 1 company so I'm not sure how common this is. It is basically a mainframe source code management system. It is made up of several stages, the highest (stage 6)being production, the lower ones being test.
In my bind, if the stored procedure is in stage 6, the bind works fine. I can run the calling program and everything works. However, if the stored procedure is not in stage 6, which will always be the case since we are testing it, then i get a bind error -440. Cannot find program.
So I started looking at the JCL for the bind. And I now wonder how it knows where to look for the stored procedure. I dont see anything pointing to specific libraries. But it is like it is defaulting to our stage 6 (production) libraries.
Does that make sense to anyone? I would like to be able to point it to the right libraries so it can find stored procedures that are lower in the Endevor food chain and bind correctly.
SQL Code -440 is not a bind error. Name of SP not found. You need to talk to your sysadmn/DBA in your shop to get the name of library for stored procedures. This should be concatenated in Stored Procedure Address Space JCL. BTW, when you compile your stored procedure program through Endevor what is library Endevor points to?
In our shop we expictly copy the SP loads in to different library which is concated with WLM step lib.
In Bind JCL you would use the DBRM Lib where your SP Program resides. Did you check SP entires were created in Catalogue tables SYSROUTINES and SYSPARM. Before you compile and bind there should be an entry in these tables.
The JCL works fine. I dont even have to point to them. I only point to the DBRM library of the calling program. So to me it appears that it somehow defaults to the production (stage 6) libraries when it looks for the called stored procedure. If I knew how, then I could overrride that somehow. I could be off, but thats where I'm headed with this at this point.
Figured it out. I needed to qualify my program name with the schema ID (if one other than SYSPROC is used). Other wise the default is SYSPROC. Thats why some worked and some didnt. We have currently have some of each.