I am coding one cobol db2 program. I am trying to code dynamic sql. But I want to pass the field names also dynamically. Is there any possibility?
EX:
Select empno, empname, esal from emp where empno = 01;
But some times i want to take different filelds also other than empno, empname, esal.
Please help me on this.
Regards,
Sekhar
Hi
Moderators: Kalicharan, Moderator Group
- dbzTHEdinosauer
- Moderator
- Posts: 981
- Joined: Mon Oct 02, 2006 8:31 pm
do you mean column names?
records have fields
db2 rows have columns.
use the correct terminology and you will be able to easily find answers in the manuals.
Suggest you do some reading. Vsn8 and Vsn9 sql reference and appl/programmers manuals have good discussions about dynamic sql.
ibm developerworks have an endless supply of examples (you have to join, but it is free) http://www.ibm.com/developerworks
This is a link for ibmdeveloperworks searches http://www.ibm.com/developerworks/views ... =15&Go.y=9
You will also benefit from the DB2 on-Campus videos
The answer to your question is yes it can be done.
records have fields
db2 rows have columns.
use the correct terminology and you will be able to easily find answers in the manuals.
Suggest you do some reading. Vsn8 and Vsn9 sql reference and appl/programmers manuals have good discussions about dynamic sql.
ibm developerworks have an endless supply of examples (you have to join, but it is free) http://www.ibm.com/developerworks
This is a link for ibmdeveloperworks searches http://www.ibm.com/developerworks/views ... =15&Go.y=9
You will also benefit from the DB2 on-Campus videos
The answer to your question is yes it can be done.
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.
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