SELECT
  RTRIM(CNPART) AS cnpart,
  CNLABS AS cnlabs,
  CNMATS AS cnmats,
  CNBURS AS cnburs,
  CNLABA AS cnlaba,
  CNMATA AS cnmata,
  CNBURA AS cnbura,
  CNLABV AS cnlabv,
  CNMATV AS cnmatv,
  CNBURV AS cnburv,
  CNTPTD AS cntptd,
  CASE WHEN CNSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE CNSDAT END AS cnsdat,
  CNSTCS AS cnstcs,
  CNACCS AS cnaccs,
  CNAVCS AS cnavcs,
  CNSTOC AS cnstoc,
  CNACOC AS cnacoc,
  CNAVOC AS cnavoc,
  CNSQTY AS cnsqty,
  CNAQTY AS cnaqty,
  RTRIM(CNPTYP) AS cnptyp,
  CNBRFS AS cnbrfs,
  CNBRVS AS cnbrvs,
  CNBRFA AS cnbrfa,
  CNBRVA AS cnbrva,
  CNBRFV AS cnbrfv,
  CNBRVV AS cnbrvv,
  RTRIM(CNPLNT) AS cnplnt,
  RTRIM(CNFUT1) AS cnfut1,
  RTRIM(CNFUT2) AS cnfut2,
  RTRIM(CNFUT3) AS cnfut3,
  CNFUT4 AS cnfut4,
  CNFUT5 AS cnfut5,
  RTRIM(CNFLG1) AS cnflg1,
  RTRIM(CNFLG2) AS cnflg2,
  RTRIM(CNFLG3) AS cnflg3
FROM LGDAT.FTCSTM
