SELECT
  "DKACC#" AS "dkacc#",
  DKFSPR AS dkfspr,
  RTRIM(DKJRTP) AS dkjrtp,
  CASE WHEN DKTDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DKTDAT END AS dktdat,
  RTRIM(DKSRCE) AS dksrce,
  DKAMT AS dkamt,
  RTRIM("DKREF#") AS "dkref#",
  RTRIM(DKREFD) AS dkrefd,
  RTRIM(DKADDD) AS dkaddd,
  RTRIM(DKREV) AS dkrev,
  RTRIM(DKREVS) AS dkrevs,
  DKFSYR AS dkfsyr,
  DKFSYY AS dkfsyy,
  RTRIM(DKPOST) AS dkpost,
  CASE WHEN DKPDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE DKPDAT END AS dkpdat,
  "DKBTC#" AS "dkbtc#",
  RTRIM(DKQUAL) AS dkqual,
  RTRIM(DKKEYN) AS dkkeyn,
  RTRIM(DKPART) AS dkpart,
  RTRIM(DKPJNM) AS dkpjnm,
  DKQTY AS dkqty,
  RTRIM(DKUNIT) AS dkunit,
  RTRIM(DKFUT1) AS dkfut1,
  RTRIM(DKFUT2) AS dkfut2,
  RTRIM(DKFUT3) AS dkfut3,
  RTRIM(DKFUT4) AS dkfut4,
  RTRIM(DKFUT5) AS dkfut5,
  RTRIM(DKFUT6) AS dkfut6,
  DKFUT7 AS dkfut7,
  RTRIM(DKFUT8) AS dkfut8,
  RTRIM(DKFUT9) AS dkfut9,
  RTRIM(DKFUT10) AS dkfut10,
  RTRIM(DKFUT11) AS dkfut11,
  RTRIM(DKFUT12) AS dkfut12,
  RTRIM(DKFUT13) AS dkfut13,
  DKFUT14 AS dkfut14,
  DKFUT15 AS dkfut15,
  DKFUT16 AS dkfut16,
  DKFUT17 AS dkfut17,
  RTRIM(DKFUT18) AS dkfut18,
  RTRIM(DKFUT19) AS dkfut19,
  RTRIM(DKFUT20) AS dkfut20,
  RTRIM(DKEMCD) AS dkemcd,
  RTRIM(DKMINS) AS dkmins,
  RTRIM(DKTERR) AS dkterr,
  "DKORD#" AS "dkord#",
  RTRIM(DKBCUS) AS dkbcus,
  DKLABH AS dklabh,
  RTRIM(DKCPYT) AS dkcpyt,
  RTRIM(DKCPYF) AS dkcpyf,
  RTRIM(DKCLSC) AS dkclsc,
  DKCFAN AS dkcfan,
  DKJRNN AS dkjrnn,
  RTRIM(DKMJSC) AS dkmjsc,
  DKBCID AS dkbcid,
  RTRIM(DKBSRF) AS dkbsrf,
  DKRCID AS dkrcid,
  DKTMS AS dktms,
  RTRIM(DKVEND) AS dkvend,
  DKADRN AS dkadrn,
  RTRIM(DKUSR) AS dkusr,
  DKWTYET AS dkwtyet,
  DKXRTE2 AS dkxrte2,
  DKXRTE3 AS dkxrte3,
  RTRIM(DKJECU) AS dkjecu,
  DKILIN AS dkilin,
  RTRIM(DKJREFC) AS dkjrefc,
  RTRIM(DKDKENT) AS dkdkent,
  DKARBTC AS dkarbtc,
  RTRIM(DKDTLP) AS dkdtlp,
  RTRIM(DKCFBR) AS dkcfbr,
  DKPBTID AS dkpbtid,
  DKPBTID2 AS dkpbtid2,
  DKLBTID AS dklbtid,
  DKLBTID2 AS dklbtid2,
  RTRIM(DKFUT21) AS dkfut21,
  RTRIM(DKFUT22) AS dkfut22,
  RTRIM(DKFUT23) AS dkfut23,
  RTRIM(DKFUT24) AS dkfut24,
  RTRIM(DKFUT25) AS dkfut25,
  RTRIM(DKFUT26) AS dkfut26,
  RTRIM(DKFUT27) AS dkfut27,
  RTRIM(DKFUT28) AS dkfut28,
  RTRIM(DKFUT29) AS dkfut29,
  DKFUT30 AS dkfut30,
  DKFUT31 AS dkfut31,
  DKFUT32 AS dkfut32,
  DKFUT33 AS dkfut33
FROM LGDAT.GTRAN
WHERE DKTMS > '{gtran_tms}'
