WITH changed AS (
    SELECT dcord# FROM lgdat.ocrh WHERE dcudat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
    UNION SELECT dcord# FROM lgdat.ocrh WHERE dcodat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
    UNION SELECT dcord# FROM lgdat.ocrh WHERE dccdat BETWEEN '{ocrs_wm}' AND CURRENT_DATE
)
SELECT
  "FFORD#" AS "fford#",
  "FFITM#" AS "ffitm#",
  "FFDIS#" AS "ffdis#",
  RTRIM(FFDISC) AS ffdisc,
  RTRIM(FFDDES) AS ffddes,
  RTRIM(FFDRCR) AS ffdrcr,
  RTRIM(FFBANT) AS ffbant,
  FFPERC AS ffperc,
  FFDAMT AS ffdamt,
  RTRIM(FFAPER) AS ffaper,
  FFDEXT AS ffdext,
  RTRIM(FFAUNT) AS ffaunt,
  RTRIM(FFRTEF) AS ffrtef,
  FFRNDD AS ffrndd,
  RTRIM(FFAPLY) AS ffaply
FROM LGDAT.OCRS
WHERE "FFORD#" IN (SELECT dcord# FROM changed)
