Page 1 of 1

cobol after precompilation

PostPosted: Wed Feb 15, 2012 6:04 pm
by daemian
Hi,
After compiling the embedded sql cobol program i saw some call address insted of the sql code.could anyone please tell me what they ment.
 CALL 'DSNHADDR'
 CALL 'DSNHADD2'
 CALL 'DSNHLI'


thanks.

Re: cobol after precompilation

PostPosted: Wed Feb 15, 2012 6:29 pm
by Robert Sample
The whole point of a precompile is to change non-COBOL statements (such as EXEC CICS or SQL) into something that can be compiled using the COBOL compiler. Typically, the statements are commented out and CALL statements inserted to invoke the external subsystem and perform the requested operation. The specific called programs depend upon what you are doing in the program, and have absolutely no bearing on anything you, the application programmer, care about. IBM's DB2 developers, for example, would care about the difference between DSNHADDR and DSNHADD2 -- but the application programmer should NEVER have to worry about them.

In other words, if you really feel you have to know -- open a problem report with IBM. But don't expect to get a lot of data back since IBM may well tell you it's none of your business what DSNHADDR, DSNHADD2, and DSNHLI are or do.

Re: cobol after precompilation

PostPosted: Wed Feb 15, 2012 7:31 pm
by BillyBoyo
You could just google, you'll probably satisfy yourself that way.

Re: cobol after precompilation

PostPosted: Fri Feb 17, 2012 3:57 pm
by Anuj Dhawan
DSNADDR is called in the INIT-SQL section (or perhaps it is called SQL-INIT, have not verified). 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.

As Robert has mentioned too, SQL syntax such as EXEC SQL ... END-EXEC is not understood by the COBOL compiler. The DB2 pre-processor converts DB2 syntax into COBOL statements such as CALL and in that routines like DSNADDR and DSNHLI are called.