SELECT
  RTRIM(JHPART) AS jhpart,
  CASE WHEN JHDATE IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JHDATE END AS jhdate,
  JHTIME AS jhtime,
  RTRIM("JHJOB#") AS "jhjob#",
  JHPONR AS jhponr,
  JHPITM AS jhpitm,
  RTRIM(JHUSER) AS jhuser,
  RTRIM(JHPROG) AS jhprog,
  JHCQTY AS jhcqty,
  RTRIM(JHCTYP) AS jhctyp,
  JHMATO AS jhmato,
  JHLABO AS jhlabo,
  JHBURO AS jhburo,
  JHOTHO AS jhotho,
  JHTOTO AS jhtoto,
  JHMATN AS jhmatn,
  JHLABN AS jhlabn,
  JHBURN AS jhburn,
  JHOTHN AS jhothn,
  JHTOTN AS jhtotn,
  JHBRFO AS jhbrfo,
  JHBRVO AS jhbrvo,
  JHBRFN AS jhbrfn,
  JHBRVN AS jhbrvn,
  JHSHCO AS jhshco,
  JHCRCO AS jhcrco,
  JHSHCN AS jhshcn,
  JHCRCN AS jhcrcn,
  RTRIM(JHPLNT) AS jhplnt,
  RTRIM(JHABSO) AS jhabso,
  RTRIM(JHBOML) AS jhboml,
  RTRIM(JHLLPT) AS jhllpt,
  JHCONQ AS jhconq,
  RTRIM(JHCSTS) AS jhcsts,
  JHAVDN AS jhavdn,
  JHAVDO AS jhavdo,
  JHAV1N AS jhav1n,
  JHAV1O AS jhav1o,
  JHAV2N AS jhav2n,
  JHAV2O AS jhav2o,
  RTRIM(JHFUT1) AS jhfut1,
  RTRIM(JHFUT2) AS jhfut2,
  RTRIM(JHFUT3) AS jhfut3,
  JHFUT4 AS jhfut4,
  JHFUT5 AS jhfut5,
  RTRIM(JHFLG1) AS jhflg1,
  RTRIM(JHFLG2) AS jhflg2,
  RTRIM(JHFLG3) AS jhflg3,
  RTRIM(JHRCID) AS jhrcid,
  RTRIM(JHCRCD) AS jhcrcd,
  JHOHQT AS jhohqt,
  JHOQTA AS jhoqta
FROM LGDAT.ICSTT
WHERE JHDATE >= '{icstt_wm}'
