Page 1 of 1

bind

PostPosted: Mon Aug 24, 2009 1:42 pm
by vaishalisingh
what would happen if the timestamps are not placed while db2-cobol program compilation ? and why does the precomplier places host language calls while exxtracting SQL statements from Cobol Db2 program

Re: bind

PostPosted: Mon Aug 24, 2009 11:50 pm
by dick scherrer
Hello,

what would happen if the timestamps are not placed while db2-cobol program compilation ?
The timestamps are critical. . . There is no way to compile/bind without them. . . Possibly i misunderstand what you are asking.

and why does the precomplier places host language calls while exxtracting SQL statements from Cobol Db2 program
Because that is the way it is designed. . . Again, possibly i misunderstand . . .

You might talk with some of your co-workers and provide a more clear description of what you are looking for. When we understand this, we should be able to post more useful replies.

Re: bind

PostPosted: Tue Aug 25, 2009 1:24 pm
by GuyC
I'll give it a go :

A cobol compiler can't (couldn't) compile SQL : that is not its job. so you need to DB2 precompile.
The precompiler changes the SQL into something that the cobol compiler understands : CALL

Another output of the precompiler is the DBRM = the info that the precompiler got from the SQL-statements.
Think of it as a subroutine that does something like this (very very simplified):

procedure division using stmtno, var1, var2 ,var3,...

Evaluate stmtno
when 1 then perform the-first-SQL
when 2 then perform the-second-SQL
...
end-evaluate
.
the-first-sql.
move var1 to key-field-tab1
read vsam1
move col3 to keyfiedl-tab2
read vsam2
move column3 to var3
.


the part in the paragraph the-frst-sql is "The accesspath".

To make sure that "the-first-sql-statement" in your cobol program is the same as what is in the DBRM, DB2 chose to use a standard solution : The caller gives a timestamp (actually a version or contoken) and the callee (is that a word ?) checks if that contoken matches with what it has in its own Working-storage.

Re: bind

PostPosted: Tue Aug 25, 2009 5:42 pm
by vaishalisingh
Thanks for the reply.. i got it this time.