SELECT
  RTRIM(ABTYPE) AS abtype,
  RTRIM(ABDEPT) AS abdept,
  RTRIM(ABRESC) AS abresc,
  RTRIM(ABDES) AS abdes,
  ABBRDR AS abbrdr,
  ABCAPT AS abcapt,
  ABCREW AS abcrew,
  ABBRDP AS abbrdp,
  RTRIM(ABBLNK) AS abblnk,
  ABSTIM AS abstim,
  RTRIM(ABMACG) AS abmacg,
  CASE WHEN ABRDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE ABRDAT END AS abrdat,
  ABRTIM AS abrtim,
  RTRIM(ABTMZN) AS abtmzn,
  RTRIM(ABSCHD) AS abschd,
  RTRIM(ABFINS) AS abfins,
  ABLABS AS ablabs,
  ABLABR AS ablabr,
  ABVBRD AS abvbrd,
  RTRIM(ABFRML) AS abfrml,
  RTRIM(ABRCVL) AS abrcvl,
  ABUTLP AS abutlp,
  ABBDVP AS abbdvp,
  RTRIM(ABWPDR) AS abwpdr,
  RTRIM(ABWPRV) AS abwprv,
  RTRIM(ABCDRC) AS abcdrc,
  ABCDRF AS abcdrf,
  ABCDRV AS abcdrv,
  RTRIM(ABCDUM) AS abcdum,
  RTRIM(ABUSLF) AS abuslf,
  RTRIM(ABUSLV) AS abuslv,
  RTRIM(ABPLNT) AS abplnt,
  RTRIM(ABFUT1) AS abfut1,
  RTRIM(ABFUT2) AS abfut2,
  RTRIM(ABWSFI) AS abwsfi,
  RTRIM(ABFUT3) AS abfut3,
  RTRIM(ABFUT4) AS abfut4,
  RTRIM(ABFUT5) AS abfut5,
  ABFUT6 AS abfut6,
  RTRIM(ABFUT7) AS abfut7,
  RTRIM(ABFUT8) AS abfut8,
  RTRIM(ABFUT9) AS abfut9,
  RTRIM(ABFUTA) AS abfuta,
  RTRIM(ABFUTB) AS abfutb,
  RTRIM(ABFUTC) AS abfutc,
  RTRIM(ABDBR) AS abdbr,
  ABDBUF AS abdbuf,
  RTRIM(ABSLTP) AS absltp,
  ABLSL AS ablsl,
  ABUSL AS abusl,
  ABNPF AS abnpf,
  RTRIM(ABFUT10) AS abfut10,
  RTRIM(ABFUT11) AS abfut11,
  RTRIM(ABFUT12) AS abfut12,
  RTRIM(ABFUT13) AS abfut13,
  RTRIM(ABFUT14) AS abfut14,
  RTRIM(ABFUT15) AS abfut15,
  RTRIM(ABFUT16) AS abfut16,
  RTRIM(ABFUT17) AS abfut17,
  RTRIM(ABFUT18) AS abfut18,
  RTRIM(ABVKTR) AS abvktr,
  RTRIM(ABVKTY) AS abvkty,
  ABMCOA AS abmcoa
FROM LGDAT.RESRE
