-1

I've created and compiled a program in Cobol, but when trying to run and test it with a JCL job, I'm getting this error when reading the output. (The program compiles and the job runs without errors themselves)

SQLCODE = -991, ERROR: CALL ATTACH WAS UNABLE TO ESTABLISH AN IMPLICIT CONNECT OR OPEN TO DB2. RC1=0008 RC2=00F30034

SQLSTATE = 57015

Now I don't understand why this error occurs. The DB2 database is up and running, I can access it myself. I can't find an error in my program code either. Googling it sadly doesn't provide me a clear solution, all I can find is that the issue is either the compiling job for the program, the jcl to run it or issues with the DB2 itself.

APL
  • 101
  • 1
  • 3
  • 14
  • 2
    https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/codes/src/tpc/00f30034.html says: "The authorization ID associated with this connection is not authorized to use the specified plan name or the specified plan name does not exist." So check your plan and auhtority. – piet.t Jul 05 '18 at 06:18
  • I did make sure the plan for the job actually exists and I've asked again and it definitely is supposed to be the right one too. – APL Jul 05 '18 at 09:19

1 Answers1

5

Have you done a bind and did it work !!!, The error indicates the plan does not exist or is not authorized.
You need to talk to people at your site about the Compile/Bind process and who authorises

If you do not know know about Mainframe Cobol/DB2 compile process, try reading this

Basically --->

                                 Cobol program 
    Cobol DB2 Program ---+---->  with no  SQL   ---> Compile ----->  Executable
                         |       but calls Plan  
                         |
                         +---->  DBRM (SQL)   -----> Bind   ------>  DB2 Plan    

It is the plan that needs the DB2 authorisation to run the SQL !!! You might be able to authorise the Plan or you might need to see the DBA's

With DB2 COBOL, There is Co-Compiler (was a pre-compiler) that strips out the SQL and creates the DBRM (basically a a special SQL procedure).

It is the Bind that processes the DBRM (SQL) and creates DB2 access plans


This may seem long winded after java etc. But there are some advantages

  • The SQL is processed ahead of time and not while the program is running
  • You can check the DB2 access path at any time - Before / after execution. Useful for analysing performance issues.
  • The same DB2 access paths are used from one run to the next. This leads to fairly predictable run times.
Bruce Martin
  • 10,358
  • 1
  • 27
  • 38
  • Thanks for that. It seems like I will have to talk to the person responsible for the binds. Both my program and another program which actually makes the DB2 connection and executes SQL were not compiled by me. – APL Jul 05 '18 at 09:18
  • 1
    Some sites give the responsibility for creating binds to the developers, in others the DBA's do it. Ask around – Bruce Martin Jul 05 '18 at 11:18