DB2 program calls subprogram cursor
Moderators: Kalicharan, Moderator Group
-
- Member
- Posts: 2
- Joined: Fri Mar 30, 2012 2:03 pm
- Location: gurgaon
DB2 program calls subprogram cursor
If we call a subprogram from a program, and a cursor is defined in main program. Can we use the same cursor in subprogram or do we need to redefine the cursor in subprogram?
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
1. REDEFINE is a COBOL keyword. It is used to map the same memory differently.
2. CURSORs are DB2 objects, qualified by the plan name (module).
even though the attributes of cursor definition in two separate modules (plans) are the same, does not mean they are the same cursor.
3. if the sub-module needs the data values
returned from a FETCH of the CURSOR defined in the main program,
why not pass the data in the CALL.
anytime you think you need to define the 'same' (same select/from/where) cursor in two different modules,
you are already in a false path.
you need to rethink your logic.
2. CURSORs are DB2 objects, qualified by the plan name (module).
even though the attributes of cursor definition in two separate modules (plans) are the same, does not mean they are the same cursor.
3. if the sub-module needs the data values
returned from a FETCH of the CURSOR defined in the main program,
why not pass the data in the CALL.
anytime you think you need to define the 'same' (same select/from/where) cursor in two different modules,
you are already in a false path.
you need to rethink your logic.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page