SELECT
  RTRIM("JOPRJ#") AS "joprj#",
  RTRIM(JODES1) AS jodes1,
  RTRIM(JODES2) AS jodes2,
  RTRIM(JODES3) AS jodes3,
  RTRIM(JOSTS) AS josts,
  RTRIM(JOPTYP) AS joptyp,
  RTRIM(JOPCLS) AS jopcls,
  RTRIM(JOCUST) AS jocust,
  RTRIM(JOPSUP) AS jopsup,
  RTRIM(JOTLID) AS jotlid,
  RTRIM(JOTCOD) AS jotcod,
  JOGLN1 AS jogln1,
  JOGLN2 AS jogln2,
  RTRIM(JOGLMN) AS joglmn,
  RTRIM(JOMLGL) AS jomlgl,
  RTRIM(JOHRMG) AS johrmg,
  RTRIM(JOHREN) AS johren,
  RTRIM(JOHRAD) AS johrad,
  RTRIM(JOORIG) AS joorig,
  CASE WHEN JOWDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOWDAT END AS jowdat,
  CASE WHEN JOASDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOASDAT END AS joasdat,
  CASE WHEN JOSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOSDAT END AS josdat,
  CASE WHEN JOAEDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOAEDAT END AS joaedat,
  CASE WHEN JOEDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOEDAT END AS joedat,
  CASE WHEN JOAPDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOAPDAT END AS joapdat,
  CASE WHEN JOLIDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOLIDAT END AS jolidat,
  CASE WHEN JOPSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOPSDAT END AS jopsdat,
  RTRIM(JOSUSR) AS josusr,
  CASE WHEN JOTDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOTDAT END AS jotdat,
  RTRIM(JOCUSR) AS jocusr,
  CASE WHEN JOCDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOCDAT END AS jocdat,
  JOCTIM AS joctim,
  RTRIM(JOUUSR) AS jouusr,
  CASE WHEN JOUDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOUDAT END AS joudat,
  JOUTIM AS joutim,
  RTRIM(JOAREF) AS joaref,
  CASE WHEN JOADAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE JOADAT END AS joadat,
  JOROGA AS joroga,
  JOPPER AS jopper,
  RTRIM(JOPCMP) AS jopcmp,
  RTRIM(JOCRCD) AS jocrcd,
  RTRIM(JOHCCD) AS johccd,
  JOBUDG AS jobudg,
  JOBREV AS jobrev,
  JOACST AS joacst,
  JOACSH AS joacsh,
  JOAREV AS joarev,
  JOARVH AS joarvh,
  RTRIM(JOAPST) AS joapst,
  JOAGLN AS joagln,
  JOAAAM AS joaaam,
  JOAAMT AS joaamt,
  RTRIM(JOPPRJ) AS jopprj,
  RTRIM(JOCRCM) AS jocrcm,
  RTRIM(JOPLNT) AS joplnt,
  JOCMPS AS jocmps,
  RTRIM(JOFUT1) AS jofut1,
  RTRIM(JOFUT2) AS jofut2,
  RTRIM(JOFUT3) AS jofut3,
  RTRIM(JOFUT4) AS jofut4,
  RTRIM(JOFUT5) AS jofut5,
  RTRIM(JOFUT6) AS jofut6,
  RTRIM(JOFUT7) AS jofut7,
  RTRIM(JOFUT8) AS jofut8,
  JOFUT9 AS jofut9,
  JOFUTA AS jofuta,
  JOFUTB AS jofutb,
  RTRIM(JOFUTC) AS jofutc,
  RTRIM(JOFUTD) AS jofutd,
  RTRIM(JOFUTE) AS jofute,
  RTRIM(JOFUTF) AS jofutf,
  RTRIM(JOFUTG) AS jofutg,
  RTRIM(JOFUTH) AS jofuth,
  RTRIM(JOFUTI) AS jofuti,
  RTRIM(JOFUTJ) AS jofutj,
  RTRIM(JOFUTK) AS jofutk,
  RTRIM(JOFUTL) AS jofutl,
  JOACS1 AS joacs1,
  JOACS2 AS joacs2,
  JOACS3 AS joacs3,
  JOACS4 AS joacs4,
  JOACS5 AS joacs5,
  JOACS6 AS joacs6,
  JOACH1 AS joach1,
  JOACH2 AS joach2,
  JOACH3 AS joach3,
  JOACH4 AS joach4,
  JOACH5 AS joach5,
  JOACH6 AS joach6,
  RTRIM(JOPTSL) AS joptsl,
  JOSLGL AS joslgl,
  JOSLAM AS joslam,
  JOCSGL AS jocsgl,
  RTRIM(JOISOT) AS joisot,
  RTRIM(JOASTS) AS joasts,
  RTRIM(JOVFTM) AS jovftm,
  RTRIM(JOADSTS) AS joadsts,
  RTRIM(JONAPU) AS jonapu,
  RTRIM(JOBWOW) AS jobwow,
  RTRIM(JOFUT10) AS jofut10,
  RTRIM(JOFUT11) AS jofut11,
  RTRIM(JOFUT12) AS jofut12
FROM LGDAT.POPRJ
