SELECT
  RTRIM(ANPART) AS anpart,
  ANPREF AS anpref,
  CASE WHEN ANDATE IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE ANDATE END AS andate,
  ANMATL AS anmatl,
  ANOSDE AS anosde,
  ANROUT AS anrout,
  ANTOOL AS antool,
  RTRIM(ANENGC) AS anengc,
  RTRIM(ANREVL) AS anrevl,
  CASE WHEN ANRDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE ANRDAT END AS anrdat,
  RTRIM(ANPLNT) AS anplnt,
  RTRIM(ANFU01) AS anfu01,
  RTRIM(ANFU02) AS anfu02,
  RTRIM(ANFU03) AS anfu03,
  RTRIM(ANFU04) AS anfu04,
  ANFU05 AS anfu05,
  ANFU06 AS anfu06,
  RTRIM(ANFU07) AS anfu07,
  RTRIM(ANFU08) AS anfu08,
  RTRIM(ANFU09) AS anfu09,
  CASE WHEN ANFU10 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE ANFU10 END AS anfu10,
  CASE WHEN ANFU11 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE ANFU11 END AS anfu11
FROM LGDAT.METHH
WHERE ANDATE >= '{methh_wm}'
