DB2 CURSOR DECLARARTION in COBOL - > to be dynamic
Posted: Thu Nov 24, 2011 5:52 pm
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
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