SELECT
  RTRIM(CGPART) AS cgpart,
  CGLABS AS cglabs,
  CGMATS AS cgmats,
  CGBURS AS cgburs,
  CGLABA AS cglaba,
  CGMATA AS cgmata,
  CGBURA AS cgbura,
  CGLABV AS cglabv,
  CGMATV AS cgmatv,
  CGBURV AS cgburv,
  CGTPTD AS cgtptd,
  CASE WHEN CGSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE CGSDAT END AS cgsdat,
  CGSTCS AS cgstcs,
  CGACCS AS cgaccs,
  CGAVCS AS cgavcs,
  CGSTOC AS cgstoc,
  CGACOC AS cgacoc,
  CGAVOC AS cgavoc,
  CGSQTY AS cgsqty,
  CGAQTY AS cgaqty,
  RTRIM(CGTYPE) AS cgtype,
  CGBRFS AS cgbrfs,
  CGBRVS AS cgbrvs,
  CGBRFA AS cgbrfa,
  CGBRVA AS cgbrva,
  CGBRFV AS cgbrfv,
  CGBRVV AS cgbrvv,
  CGFUTS AS cgfuts,
  CGFUTA AS cgfuta,
  CGFUTV AS cgfutv,
  RTRIM(CGPLNT) AS cgplnt,
  RTRIM(CGFUT1) AS cgfut1,
  RTRIM(CGFUT2) AS cgfut2,
  RTRIM(CGFUT3) AS cgfut3,
  CGFUT4 AS cgfut4,
  CGFUT5 AS cgfut5,
  RTRIM(CGFLG1) AS cgflg1,
  RTRIM(CGFLG2) AS cgflg2,
  RTRIM(CGFLG3) AS cgflg3,
  RTRIM(CGFUT6) AS cgfut6,
  RTRIM(CGFUT7) AS cgfut7,
  RTRIM(CGFUT8) AS cgfut8,
  RTRIM(CGFUT9) AS cgfut9,
  RTRIM(CGFUT10) AS cgfut10,
  RTRIM(CGFUT11) AS cgfut11,
  CGFUT12 AS cgfut12,
  CGFUT13 AS cgfut13,
  CGFUT14 AS cgfut14
FROM LGDAT.ICSTM
