SELECT
  RTRIM(D35GCDE) AS d35gcde,
  RTRIM(D35DES1) AS d35des1,
  RTRIM(D35DES2) AS d35des2,
  RTRIM(D35DES3) AS d35des3,
  RTRIM(D35USR1) AS d35usr1,
  RTRIM(D35USR2) AS d35usr2,
  RTRIM(D35USR3) AS d35usr3,
  D35USR4 AS d35usr4,
  D35USR5 AS d35usr5,
  RTRIM(D35CUSR) AS d35cusr,
  CASE WHEN D35CDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE D35CDAT END AS d35cdat,
  D35CTME AS d35ctme,
  RTRIM(D35UUSR) AS d35uusr,
  CASE WHEN D35UDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE D35UDAT END AS d35udat,
  D35UTME AS d35utme
FROM LGDAT.GGTP
