SELECT
  RTRIM(COPART) AS copart,
  COLUC AS coluc,
  COLCC AS colcc,
  COLFC AS colfc,
  COLDC AS coldc,
  COL1C AS col1c,
  COL2C AS col2c,
  COSUC AS cosuc,
  COSCC AS coscc,
  COSFC AS cosfc,
  COSDC AS cosdc,
  COS1C AS cos1c,
  COS2C AS cos2c,
  COSCR AS coscr,
  COLCR AS colcr,
  CASE WHEN COSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE COSDAT END AS cosdat,
  COSTCS AS costcs,
  COACCS AS coaccs,
  COAVCS AS coavcs,
  COSDR AS cosdr,
  COS1R AS cos1r,
  COS2R AS cos2r,
  COLDR AS coldr,
  COL1R AS col1r,
  COL2R AS col2r,
  COSQTY AS cosqty,
  COAQTY AS coaqty,
  RTRIM(COTYPE) AS cotype,
  RTRIM(COCURR) AS cocurr,
  RTRIM(COPLNT) AS coplnt,
  COAVUC AS coavuc,
  COAVXC AS coavxc,
  COAVDC AS coavdc,
  COAV1C AS coav1c,
  COAV2C AS coav2c,
  COAVFC AS coavfc,
  RTRIM(COFUT1) AS cofut1,
  RTRIM(COFUT2) AS cofut2,
  RTRIM(COFUT3) AS cofut3,
  COFUT4 AS cofut4,
  COFUT5 AS cofut5,
  RTRIM(COFLG1) AS coflg1,
  RTRIM(COFLG2) AS coflg2,
  RTRIM(COFLG3) AS coflg3,
  RTRIM(COFLG4) AS coflg4,
  RTRIM(COFLG5) AS coflg5,
  RTRIM(COFLG6) AS coflg6,
  RTRIM(COFLG7) AS coflg7,
  RTRIM(COCRCD) AS cocrcd
FROM LGDAT.FTCSTP
