Hi Friends,
I need a clarification on my below query.
For example:
I have a program which generates a report on Employees of the organistion fetching the Employee number, Name & Age from table.
Now i have a requirement to have instance of jobs, 1 would generate a report for the employees who are working in Computers sections and other report coering employees in Production, Maintenance & Sales by using Dept field in table.
Currently SQL cursor is like
EXEC SQL
DECLARE EMP_CSR CURSOR FOR
SELECT EMP_NO
,EMP_NAME
,EMP_AGE
FROM EMP_TABLE
ORDER BY EMP_NO
END-EXEC.
Now i need this to be amended to have where condition like
WHERE EMP_DEPT in ('PROD','MAIN','SALE') for one report and for another it should be like
WHERE EMP_DEPT = 'COMP'
I want to have same program and two jobs and the where condition should be decided based on the value i pass through JCL PARM Parameter.
For example if i pass 'C' as my JCL PARM value then the job should generate a report only for employees in Computers dept. If if pass 'O' the value should generate report for employees from production, maintenanace & Sales...
Thanks,
Divakar
DB2 CURSOR DECLARARTION in COBOL - > to be dynamic
Moderators: Kalicharan, Moderator Group
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
-
- Member
- Posts: 32
- Joined: Mon Sep 12, 2011 10:50 am
- Location: Bangalore
I think what you did is the best way (According to me)....
otherwise you need to have an extra column having the flag value either "C" or "O"
&by adding this into cursor u acn query ....example
EXEC SQL
DECLARE EMP_CSR CURSOR FOR
SELECT EMP_NO
,EMP_NAME
,EMP_AGE
FROM EMP_TABLE
WHERE (EMP_DEPT in ('PROD','MAIN','SALE') AND FLAG_COL='O')
OR (EMP_DEPT = 'COMP' AND FLAG_COL='C')
ORDER BY EMP_NO
END-EXEC.
where FLAG_COL= flag value stored either "O" for'PROD','MAIN','SALE'
or "C" for Computers
corrections are most welcome
otherwise you need to have an extra column having the flag value either "C" or "O"
&by adding this into cursor u acn query ....example
EXEC SQL
DECLARE EMP_CSR CURSOR FOR
SELECT EMP_NO
,EMP_NAME
,EMP_AGE
FROM EMP_TABLE
WHERE (EMP_DEPT in ('PROD','MAIN','SALE') AND FLAG_COL='O')
OR (EMP_DEPT = 'COMP' AND FLAG_COL='C')
ORDER BY EMP_NO
END-EXEC.
where FLAG_COL= flag value stored either "O" for'PROD','MAIN','SALE'
or "C" for Computers
corrections are most welcome
Thanks & Regards
Dev
Dev
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