SELECT
  RTRIM(DNJOB) AS dnjob,
  RTRIM(DNPART) AS dnpart,
  RTRIM(DNCUST) AS dncust,
  RTRIM(DNNAME) AS dnname,
  RTRIM(DNPRT) AS dnprt,
  RTRIM(DNDES) AS dndes,
  RTRIM(DNPO) AS dnpo,
  CASE WHEN DNODAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNODAT END AS dnodat,
  DNQTYR AS dnqtyr,
  CASE WHEN DNRDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNRDAT END AS dnrdat,
  DNRTIM AS dnrtim,
  RTRIM(DNTMZN) AS dntmzn,
  DNNMAT AS dnnmat,
  DNNOS AS dnnos,
  DNNROT AS dnnrot,
  RTRIM(DNSTAT) AS dnstat,
  RTRIM(DNPRNT) AS dnprnt,
  RTRIM(DNBK01) AS dnbk01,
  RTRIM(DNFLAG) AS dnflag,
  CASE WHEN DNSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNSDAT END AS dnsdat,
  DNSTIM AS dnstim,
  CASE WHEN DNEDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNEDAT END AS dnedat,
  DNETIM AS dnetim,
  DNSCMP AS dnscmp,
  CASE WHEN DNBDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNBDAT END AS dnbdat,
  RTRIM(DNBK04) AS dnbk04,
  RTRIM(DNSMTH) AS dnsmth,
  DNQCMP AS dnqcmp,
  CASE WHEN DNCDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNCDAT END AS dncdat,
  DNCTIM AS dnctim,
  DNASEQ AS dnaseq,
  CASE WHEN DNFDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNFDAT END AS dnfdat,
  DNFTIM AS dnftim,
  RTRIM(DNPREF) AS dnpref,
  "DNORD#" AS "dnord#",
  "DNITM#" AS "dnitm#",
  RTRIM(DNUNIT) AS dnunit,
  RTRIM(DNSTKL) AS dnstkl,
  RTRIM(DNPLAN) AS dnplan,
  RTRIM(DNPARN) AS dnparn,
  RTRIM("DNREL#") AS "dnrel#",
  RTRIM(DNPLNT) AS dnplnt,
  RTRIM(DNFUT1) AS dnfut1,
  RTRIM(DNFUT2) AS dnfut2,
  RTRIM(DNFUT3) AS dnfut3,
  RTRIM(DNFUT4) AS dnfut4,
  RTRIM(DNFUT5) AS dnfut5,
  RTRIM(DNFUT6) AS dnfut6,
  RTRIM(DNFUT7) AS dnfut7,
  RTRIM(DNFUT8) AS dnfut8,
  RTRIM(DNFUT9) AS dnfut9,
  RTRIM(DNFUTA) AS dnfuta,
  DNFUTB AS dnfutb,
  DNFUTC AS dnfutc,
  RTRIM(DNMCHG) AS dnmchg,
  CASE WHEN DNMDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DNMDAT END AS dnmdat,
  DNALTM AS dnaltm,
  RTRIM(DNENGC) AS dnengc,
  RTRIM(DNCREV) AS dncrev,
  DNALTMN AS dnaltmn,
  RTRIM(DNRAN) AS dnran,
  RTRIM(DNENGCN) AS dnengcn,
  DNTPER AS dntper,
  RTRIM(DNUSBCM) AS dnusbcm,
  RTRIM(DNERVN) AS dnervn,
  RTRIM(DNMPTY) AS dnmpty,
  RTRIM(DNSFOMC) AS dnsfomc,
  RTRIM(DNFUT10) AS dnfut10,
  RTRIM(DNFUT11) AS dnfut11,
  RTRIM(DNFUT12) AS dnfut12,
  RTRIM(DNFUT13) AS dnfut13,
  RTRIM(DNFUT14) AS dnfut14,
  RTRIM(DNFUT15) AS dnfut15,
  RTRIM(DNFUT16) AS dnfut16,
  RTRIM(DNFUT17) AS dnfut17,
  RTRIM(DNFUT18) AS dnfut18,
  RTRIM(DNFUT19) AS dnfut19,
  RTRIM(DNFUT20) AS dnfut20,
  RTRIM(DNFUT21) AS dnfut21,
  RTRIM(DNFUT22) AS dnfut22,
  RTRIM(DNFUT23) AS dnfut23,
  RTRIM(DNFUT24) AS dnfut24,
  RTRIM(DNFUT25) AS dnfut25,
  RTRIM(DNFUT26) AS dnfut26,
  RTRIM(DNFUT27) AS dnfut27,
  DNFUT28 AS dnfut28,
  DNFUT29 AS dnfut29,
  DNFUT30 AS dnfut30
FROM LGDAT.CJOBH
