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

why we are linking a cob-db2 with SP using DSNRLI?


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

Active User


Joined: 15 Dec 2005
Posts: 271

PostPosted: Wed Jun 23, 2010 8:02 pm
Reply with quote

Folks,

In my project, a cob-db2 program is used just to open a cursor.(declare cursor is used with return option) and it is link-edited with DDL(i.e. stored procedure) using DSNRLI. why we need to develop a cob-db2 program and to open a cursor instead it can be coded inside the DDL of Stored procedure itself. Don't ask me that why you didn't ask the question to your colleague, since they follow this method for so many years they are sticking to it.

sample code of cob db2
Code:


EXEC SQL DECLARE C4 CURSOR WITH HOLD WITH RETURN FOR
           SELECT PROJNO, PROJNAME
           FROM DSN8910.PROJ
           WHERE DEPTNO = 'A01';

Procedure division
.
.
exec sql
open c 4
end-exec





Thanks,
Murali.
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: Wed Jun 23, 2010 9:47 pm
Reply with quote

Hello,

Quote:
why we need to develop a cob-db2 program and to open a cursor instead it can be coded inside the DDL of Stored procedure itself
Because that is the convention in your environment.

If the enviuronment has been running for a very long time, the people who made the rules may have already gone elsewhere leaving behind no explanation as to why one way was chosen rather than some other.

Suggest that if everything works as-is, you continue with the current convention. A review and change may be in order, but this should not be done without agreement/direction from management. . .
Back to top
View user's profile Send private message
wanderer

Active User


Joined: 05 Feb 2007
Posts: 199
Location: Sri Lanka

PostPosted: Thu Jun 24, 2010 5:31 pm
Reply with quote

Mostly because that is how IBM designed those things and interfaces that open cursor can't be coded in SP DDL. But with Db2 V9 a lot of procedural SQLs are allowed in SP DDL and you need not use external application languages like COBOL depending on your requirement.
Back to top
View user's profile Send private message
smachohalla

New User


Joined: 25 Mar 2008
Posts: 6
Location: Chennai

PostPosted: Thu Apr 07, 2011 7:52 pm
Reply with quote

Hey ive come across situations like this. If a called sub program (cobdb2) just opens a cursor, then the recordset of the cursor is returned back to the calling program. This is the point here. Also those kind of cursor are declared with 'WITH RETURN' keyword as given in your code., this means the whole cursor recordset content is returned back to the calling pgm
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 linking an ALC program to a Relationa... PL/I & Assembler 1
No new posts Authorization for compiling and linki... All Other Mainframe Topics 5
No new posts COBOL programs dynamic linking COBOL Programming 24
No new posts Problem while linking to a dynamicall... IMS DB/DC 6
No new posts LINKing DB2 Module CICS 10
Search our Forums:

Back to Top