Can any one please let me know the uses of DSNADDR, DSNADD2 and DSNHLI. In complist , I have seen the appropriate call statements for the replacement of SQL Statements.
Why are we calling those routines and what purpose do they serve. Are those any calls to the stored procedures, or DBRM's( App. Pgm. once precomplied, replaces SQL Queries with calls, stores SQL Queries into DBRMLIB).
Also can anyone suggest me in finding an oustanding book on COBOL+DB2
Joined: 23 Mar 2007 Posts: 149 Location: Ottawa Canada
DSNADDR is called in the INIT-SQL section (or perhaps it is called SQL-INIT - this is off the top of my head). Its purpose is to establish addressability to each of the host variables that your program uses. DSNHLI (High Level Interface) is called to execute an SQL statement.
I'm not certain about DSNADD2 but I would guess that it performs a similar function as DSNADDR.
Remember that SQL syntax such as EXEC SQL SELECT .... is not understood by the cobol compiler. The DB2 pre-processor converts DB2 syntax into COBOL statements such as CALL. What routines get CALLed? Routines like DSNADDR and DSNHLI.