SELECT  wot.WTUKID AS UniqueID,
        wot.WTDOCO AS WorkOrderNumber,
        wot.WTOPSQ/10 AS StepNumber,
        TRIM(wot.WTMCU) AS WorkCenterCode,
	    TRIM(wot.WTMMCU) AS BranchCode,
	    wot.WTAN8 AS AddressNumber,
		CASE wot.WTDGL WHEN 0 THEN NULL ELSE TO_DATE(wot.WTDGL+1900000,'YYYYDDD') END AS GlDate,
		wot.WTUPMJ AS LastUpdateDate,
		wot.WTTDAY AS LastUpdateTime
  FROM  ARCDTAPD.F31122 wot
  WHERE TRIM(wot.WTMCU) IS NOT NULL AND
        TRIM(wot.WTMMCU) IS NOT NULL