SELECT A.EMPLID , CASE WHEN B.DTTM_MODIFIED > %Dttm(A.EFFDT, %TIMEIN('23.59.00.000000')) THEN B.DTTM_MODIFIED ELSE %Dttm(A.EFFDT, %TIMEIN('23.59.00.000000')) END FROM %Table(RS_WRKR_EFFDT) A LEFT OUTER JOIN PS_RS_SRCH_LOG B ON B.DOCUMENT = A.EMPLID AND B.ACTION_FLG = 'D' WHERE A.SYSTEM_SOURCE = 'STF' AND %EffdtCheck(RS_WRKR_EFFDT Z, A, %CurrentDateIn) AND A.WRKR_INELIGIBLE = 'Y' UNION SELECT A.APPLID , B.DTTM_MODIFIED FROM %Table(APPLICANT) A , PS_RS_SRCH_LOG B WHERE B.DOCUMENT = A.APPLID AND B.ACTION_FLG = 'D'
|