As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.
Join the TIBCO Community TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.
From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
Request access to the private WebFOCUS User Group (login required) to network with fellow members.
Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.
I have multiple excel worksheet that is basically represents a months data, April thru March because our fiscal year start in April The first few sheets are filled properly April, May, June and July August we don't have data for so it errors out. I've tried some error handling but it doesn't work because I'm new at this. My error handling starts in august portion of the code where I have put **************************
Any suggestions would be helpful
APP HOLD MFG APP FI FURN1 DISK FURN1.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'APRIL') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'APRIL') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN1 FORMAT EXL2K TEMPLATE 'FURNACE' SHEETNUMBER 15 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, GRID=OFF, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN2 FURN2.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'MAY') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'MAY') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN2 FORMAT EXL2K TEMPLATE 'FURN1' SHEETNUMBER 16 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN3 FURN3.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JUNE') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JUNE') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN3 FORMAT EXL2K TEMPLATE 'FURN2' SHEETNUMBER 17 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN4 FURN4.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JULY') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JULY') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN4 FORMAT EXL2K TEMPLATE 'FURN3' SHEETNUMBER 18 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN5 FURN5.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'AUGUST') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'AUGUST') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END -IF &LINES EQ 0 THEN ENDAUG; ***************************************************************88 TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN5 FORMAT EXL2K TEMPLATE 'FURN4' SHEETNUMBER 19 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN6 FURN6.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'SEPTEMBER') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'SEPTEMBER') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN6 FORMAT EXL2K TEMPLATE 'FURN5' SHEETNUMBER 20 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN7 FURN7.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'OCTOBER') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'OCTOBER') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN7 FORMAT EXL2K TEMPLATE 'FURN6' SHEETNUMBER 21 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN8 FURN8.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'NOVEMBER') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'NOVEMBER') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN8 FORMAT EXL2K TEMPLATE 'FURN7' SHEETNUMBER 22 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN9 FURN9.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'DECEMBER') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'DECEMBER') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN9 FORMAT EXL2K TEMPLATE 'FURN8' SHEETNUMBER 23 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN10 FURN10.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JANUARY') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'JANUARY') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN10 FORMAT EXL2K TEMPLATE 'FURN9' SHEETNUMBER 24 ON TABLE SET STYLE * UNITS=IN, PAGESIZE='Letter', LEFTMARGIN=0.250000, RIGHTMARGIN=0.250000, TOPMARGIN=0.250000, BOTTOMMARGIN=0.250000, SQUEEZE=ON, ORIENTATION=PORTRAIT, $ TYPE=REPORT, FONT='TIMES NEW ROMAN', SIZE=10, COLOR='BLACK', BACKCOLOR='NONE', STYLE=NORMAL, $ ENDSTYLE END APP FI FURN11 FURN11.MHT ENGINE SQLORA SET DEFAULT_CONNECTION prodmfg SQL SQLORA PREPARE SQLOUT FOR SELECT molds, furnace, employeeno, DL, EMP_NAME, RANK() OVER(PARTITION BY FURNACE ORDER BY molds desc) AS ROWRANK FROM (select molds, furnace, employeeno, dl,EMP_NAME from (SELECT COUNT(fd.workorderno) as molds, FD.CASTING_FURNACE as furnace, fd.cast_emp as employeeno, 0 as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME FROM fd_heat_master fd, employees e, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'FEBRUARY') FY where TRUNC(fd.cast_dt) >= FY.MN_BEGIN AND TRUNC(fd.cast_dt) <= FY.MN_END AND FD.CAST_EMP in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') AND FD.CAST_EMP = E.EMPLOYEENO GROUP BY FD.CASTING_FURNACE, fd.cast_emp,E.GIVEN_NAME ||','||E.SURNAME) union all select 0 as molds, ' ' as furnace, lh.employeeno as employeeno, sum(lh.act_lab_hrs) as dl, E.GIVEN_NAME ||','||E.SURNAME AS EMP_NAME from labour_history lh, EMPLOYEES E, (SELECT DISTINCT TO_DATE(MONTH_BEGIN, 'YYYYMMDD') MN_BEGIN, to_date(MONTH_end, 'YYYYMMDD') MN_END FROM VISIB.FISCAL_CALENDAR WHERE FISCAL_YEAR = (SELECT FISCAL_YEAR FROM VISIB.FOCUS_CALENDAR WHERE DATE_KEY = TRUNC(SYSDATE)) AND month_name = 'FEBRUARY') FY where TRUNC(lh.timedate) >= FY.MN_BEGIN AND TRUNC(lh.timedate) <= FY.MN_END AND lh.employeeno in ('5767', '1371', '5759', '4631', '2174', '5700', '5769', '3434', '2913', '4539', '4931', '8651', '4936', '2256', '5798') and lh.labour_type <= '19' and lh.employeeno = e.employeeno group by lh.employeeno,E.GIVEN_NAME ||','||E.SURNAME ); END TABLE FILE SQLOUT PRINT MOLDS/D5 ROWRANK/D3 FURNACE EMPLOYEENO DL/D8.2 EMP_NAME ON TABLE SET PAGE-NUM OFF ON TABLE NOTOTAL ON TABLE HOLD AS FURN11 FORMAT EXL2K TEMPLATE 'FURN10' SHEETNUMBER 25 ON TABLE SET STYLE * UNITS=IN, PAGESIZThis message has been edited. Last edited by: Kerry,
Try this -- use a -RUN to force execution of the previous SELECT query; add a GOTO to your -IF statement; and insert a -ENDAUG label for the code to branch to: