View previous topic :: View next topic
|
Author |
Message |
pkmurali Warnings : 1 Active User
Joined: 15 Dec 2005 Posts: 271
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
wanderer
Active User
Joined: 05 Feb 2007 Posts: 199 Location: Sri Lanka
|
|
|
|
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 |
|
|
smachohalla
New User
Joined: 25 Mar 2008 Posts: 6 Location: Chennai
|
|
|
|
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 |
|
|
|