SELECT
  RTRIM(BK7CODE) AS bk7code,
  RTRIM(BK7DES1) AS bk7des1,
  RTRIM(BK7DES2) AS bk7des2,
  RTRIM(BK7DES3) AS bk7des3,
  RTRIM(BK7TRAD) AS bk7trad,
  RTRIM(BK7CARC) AS bk7carc,
  RTRIM(BK7SERC) AS bk7serc,
  RTRIM(BK7CUSR) AS bk7cusr,
  CASE WHEN BK7CDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BK7CDAT END AS bk7cdat,
  BK7CTME AS bk7ctme,
  RTRIM(BK7UUSR) AS bk7uusr,
  CASE WHEN BK7UDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BK7UDAT END AS bk7udat,
  BK7UTME AS bk7utme,
  RTRIM(BK7SNDAT) AS bk7sndat,
  RTRIM(BK7FUT01) AS bk7fut01,
  RTRIM(BK7FUT02) AS bk7fut02,
  RTRIM(BK7FUT03) AS bk7fut03,
  RTRIM(BK7FUT04) AS bk7fut04,
  RTRIM(BK7FUT05) AS bk7fut05,
  RTRIM(BK7FUT06) AS bk7fut06,
  BK7FUT07 AS bk7fut07,
  BK7FUT08 AS bk7fut08,
  BK7FUT09 AS bk7fut09,
  BK7FUT10 AS bk7fut10,
  RTRIM(BK7DBUY) AS bk7dbuy,
  RTRIM(BK7DBAC) AS bk7dbac,
  RTRIM(BK7PROM) AS bk7prom,
  RTRIM(BK7OTYP) AS bk7otyp,
  RTRIM(BK7AVAC) AS bk7avac,
  RTRIM(BK7QTHR) AS bk7qthr,
  RTRIM(BK7APPV) AS bk7appv,
  BK7APPD AS bk7appd,
  RTRIM(BK7APHR) AS bk7aphr,
  RTRIM(BK7PLCD) AS bk7plcd,
  RTRIM(BK7EDIS) AS bk7edis,
  RTRIM(BK7EXPO) AS bk7expo,
  RTRIM(BK7F0PR) AS bk7f0pr,
  BK7PRTY AS bk7prty
FROM LGDAT.SACH
