IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

-818 SQLCODE error


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 115
Location: Hyderabad

PostPosted: Fri May 15, 2009 11:17 am
Reply with quote

Hi,

I have a DB2 cobol program.

The general program preparation process is

1) Precompilation
2) Bind
3) Compile
4) link edit
5) Run

After link edit and before run, I am doing a bind to a plan. using the option in
12. DB2I PRIMARY OPTION MENU -> 5. BIND/REBIND/FREE -> 1. BIND
PLAN

Here I am specifying the plan name and DBRM library and DBRM member which i want to bind.

Now I have two scenarios.

Scenario1:

I have changed something in an SQL statement and compiled the program. Now it generates a new DBRM and places a new time stamp in the the DBRM and same timestamp in the load module. So when i bind the program before i run it, using 12->5->1 the plan will b replaced with latest timestamp in the DBRM. No issues with that and i dont get a -818

Scenario 2:

I have changed something in my cobol code (not in SQLs). I have compiled it. a new DBRM gets generated with latest time stamp and the same time stamp is placed in load module also. But this time i am not interested to bind the DBRM to a plan. But still the program is running fine. Why is it not throwing a -818 as it compares the time stamp present in the load and plan?

Please correct me if I am wrong some where.
I checked all the posts related to -818. But no clue for my question.

Thanks
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri May 15, 2009 2:41 pm
Reply with quote

You should start looking at the manuals for sql errorcodes.
As you read the description (below), you will see where you went wrong.

-818
Reason: THE PRECOMPILER GENERATED TIMESTAMP x IN THE LOAD MODULE IS DIFFERENT FROM THE BIND TIMESTAMP y BUILT FROM THE DBRM z

Description: The SQL precompiler places timestamp 'y' in the DBRM, and time stamp 'x' in the parameter list in the application program for each SQL statement. At BIND time, DB2 stores the DBRM timestamp for run time use. At run time, timestamp 'x', for the SQL statement being processed,is compared with timestamp 'y' derived from the DBRM 'z' at BIND time. If the two timestamps do not match, the DBRM and the application program were not the result of the same precompile. This problem can occur if you:
  • Precompile, compile, and link, without doing a BIND of the application,
  • Precompile and BIND, without doing the compile and link for the application program, or
  • BIND the application using a DBRM that resulted from a different precompile of the application program than that which produced the object module that is linked into the application module.
The timestamps 'x' and 'y' are DB2 internal timestamps. They do not have an external interpretation.

User Response: BIND the application again, using the DBRM for the application program that matches the object module.
Back to top
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 115
Location: Hyderabad

PostPosted: Fri May 15, 2009 4:33 pm
Reply with quote

Quote:

This problem can occur if you:
Precompile, compile, and link, without doing a BIND of the application,



This is the scenario 2 i had written above in my question. I haven't made any changes to SQLs but made changes to the cobol code and I dinn bind it. But it is not throwing -818 error.

Can some one please explain this. I've read this explaination (on -818) from manuals and many other books.
Back to top
View user's profile Send private message
Raghu navaikulam

Active User


Joined: 27 Sep 2008
Posts: 193
Location: chennai

PostPosted: Sun May 17, 2009 12:07 am
Reply with quote

Hi kranthikumarb

Quote:
Scenario 2:

I have changed something in my cobol code (not in SQLs). I have compiled it. a new DBRM gets generated with latest time stamp and the same time stamp is placed in load module also. But this time i am not interested to bind the DBRM to a plan. But still the program is running fine. Why is it not throwing a -818 as it compares the time stamp present in the load and plan?


Quote:
I have compiled it.

How do you compiled your program.
Since you program is a DB2-COBOL, COBOL compiler will give error when it encounters an SQL statement.
Did you used the pre-compiled output of the program for compilation?

Quote:
a new DBRM gets generated with latest time stamp and the same time stamp is placed in load module also


Without pre-compilation a new DBRM is not going to generate.

Quote:
But this time i am not interested to bind the DBRM to a plan.


Since you have a Validated DBRM in the DB2 Directory for the same load module, that will be loaded when executing the program. Here your DBRM is not generated and you didn't BIND it again. So you are using the old plan which is created earlier. Hence there is no question of -818.(timestamp mismatch)
Your quries are welcome in this regard.

Regards
Raghu
Back to top
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 115
Location: Hyderabad

PostPosted: Mon May 18, 2009 2:53 pm
Reply with quote

Hi Raghu,

I've a macro using which we compile a program. It automatically does the precompile,compile and link edit.
I am not doing all these steps manually.

I could see the precompile step in the sd;st screen.That means the DBRM was generated.
Back to top
View user's profile Send private message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Tue May 19, 2009 10:51 am
Reply with quote

Hi kranthikumarb,

Check your cobol changes. Might be after cobol changes you are not executing the SQL statements. Until you are not executing the SQL ststements , you wont get -818.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 19, 2009 7:48 pm
Reply with quote

Hello,

That is rather confusing. . . icon_confused.gif

Some clarification is needed or this should be deleted. . .
Back to top
View user's profile Send private message
vinit_infy
Warnings : 1

New User


Joined: 07 Apr 2005
Posts: 56

PostPosted: Wed May 20, 2009 10:19 am
Reply with quote

Dick,

What i mean to say is, since before kranthikumarb's cobol changes program was running fine after package bind.

But when he did some cobol changes he didn't run the bind and even then he is not getting -818. Whenever we compile a cobol-db2 program, everytime timestamps changes and so we need BIND. But if the control is not going to any EXEC SQL statement then, it wont check the timestamps and wont fail with -818.

So, may be kranthikumarb's new cobol changes are bypassing the EXEC SQL statemements / not executing the sql statements.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Getting Error while trying to establi... DB2 3
Search our Forums:

Back to Top