SELECT
  RTRIM(CHPART) AS chpart,
  CHLUC AS chluc,
  CHLCC AS chlcc,
  CHLFC AS chlfc,
  CHLDC AS chldc,
  CHL1C AS chl1c,
  CHL2C AS chl2c,
  CHSUC AS chsuc,
  CHSCC AS chscc,
  CHSFC AS chsfc,
  CHSDC AS chsdc,
  CHS1C AS chs1c,
  CHS2C AS chs2c,
  CHSCR AS chscr,
  CHLCR AS chlcr,
  CASE WHEN CHSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE CHSDAT END AS chsdat,
  CHSTCS AS chstcs,
  CHACCS AS chaccs,
  CHAVCS AS chavcs,
  CHSDR AS chsdr,
  CHS1R AS chs1r,
  CHS2R AS chs2r,
  CHLDR AS chldr,
  CHL1R AS chl1r,
  CHL2R AS chl2r,
  CHSQTY AS chsqty,
  CHAQTY AS chaqty,
  RTRIM(CHTYPE) AS chtype,
  RTRIM(CHCURR) AS chcurr,
  CHSDWC AS chsdwc,
  CHACWC AS chacwc,
  RTRIM(CHPLNT) AS chplnt,
  CHAVUC AS chavuc,
  CHAVXC AS chavxc,
  CHAVDC AS chavdc,
  CHAV1C AS chav1c,
  CHAV2C AS chav2c,
  CHAVFC AS chavfc,
  RTRIM(CHFUT1) AS chfut1,
  RTRIM(CHFUT2) AS chfut2,
  RTRIM(CHFUT3) AS chfut3,
  CHFUT4 AS chfut4,
  CHFUT5 AS chfut5,
  RTRIM(CHFLG1) AS chflg1,
  RTRIM(CHFLG2) AS chflg2,
  RTRIM(CHFLG3) AS chflg3,
  RTRIM(CHFLG4) AS chflg4,
  RTRIM(CHFLG5) AS chflg5,
  RTRIM(CHFLG6) AS chflg6,
  RTRIM(CHFLG7) AS chflg7,
  RTRIM(CHCRCD) AS chcrcd,
  RTRIM(CHFUT6) AS chfut6,
  RTRIM(CHFUT7) AS chfut7,
  RTRIM(CHFUT8) AS chfut8,
  RTRIM(CHFUT9) AS chfut9,
  RTRIM(CHFUT10) AS chfut10,
  RTRIM(CHFUT11) AS chfut11,
  CHFUT12 AS chfut12,
  CHFUT13 AS chfut13,
  CHFUT14 AS chfut14
FROM LGDAT.ICSTP
