SELECT
  BTPYTD AS btpytd,
  RTRIM(BTNAME) AS btname,
  RTRIM(BTADR1) AS btadr1,
  RTRIM(BTADR2) AS btadr2,
  RTRIM(BTADR3) AS btadr3,
  RTRIM(BTADR4) AS btadr4,
  RTRIM(BTADR5) AS btadr5,
  RTRIM(BTADR6) AS btadr6,
  RTRIM(BTADR7) AS btadr7,
  RTRIM(BTADR8) AS btadr8,
  RTRIM(BTADR9) AS btadr9,
  RTRIM(BTADR10) AS btadr10,
  RTRIM(BTPOST) AS btpost,
  RTRIM(BTCITY) AS btcity,
  RTRIM("BTTEL#") AS "bttel#",
  RTRIM(BTBANK) AS btbank,
  BTPERC AS btperc,
  BTTERM AS btterm,
  BTCYTD AS btcytd,
  CASE WHEN BTLDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BTLDAT END AS btldat,
  RTRIM(BTCLAS) AS btclas,
  RTRIM(BTGSTF) AS btgstf,
  BTNETD AS btnetd,
  RTRIM(BTCURR) AS btcurr,
  BTSORT AS btsort,
  RTRIM(BTCONT) AS btcont,
  RTRIM(BTVEND) AS btvend,
  RTRIM("BTFAX#") AS "btfax#",
  RTRIM(BTGSTL) AS btgstl,
  RTRIM(BTTRMC) AS bttrmc,
  RTRIM(BTFOBC) AS btfobc,
  RTRIM(BTTAXG) AS bttaxg,
  RTRIM(BTTAXR) AS bttaxr,
  RTRIM(BTTAXS) AS bttaxs,
  RTRIM(BTRMIT) AS btrmit,
  RTRIM(BTOSSL) AS btossl,
  RTRIM(BTDUNS) AS btduns,
  RTRIM(BTAUVF) AS btauvf,
  RTRIM(BTCPVR) AS btcpvr,
  RTRIM(BTCARC) AS btcarc,
  RTRIM(BTCBRC) AS btcbrc,
  BTAPPD AS btappd,
  RTRIM(BTMINF) AS btminf,
  RTRIM(BTVNRM) AS btvnrm,
  RTRIM(BTBKRM) AS btbkrm,
  RTRIM(BTINSP) AS btinsp,
  RTRIM(BTPSAC) AS btpsac,
  RTRIM(BTPSFR) AS btpsfr,
  RTRIM(BTPSDY) AS btpsdy,
  RTRIM(BTPSDR) AS btpsdr,
  RTRIM(BTSSAC) AS btssac,
  RTRIM(BTSSFR) AS btssfr,
  RTRIM(BTSSDY) AS btssdy,
  RTRIM(BTSSDR) AS btssdr,
  RTRIM(BTPEDI) AS btpedi,
  RTRIM(BTSEDI) AS btsedi,
  RTRIM(BTCNTC) AS btcntc,
  RTRIM(BTFAXP) AS btfaxp,
  RTRIM(BTEMAL) AS btemal,
  RTRIM(BTWPAG) AS btwpag,
  RTRIM(BTFLG1) AS btflg1,
  RTRIM(BTCUSR) AS btcusr,
  CASE WHEN BTCDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BTCDAT END AS btcdat,
  BTCTME AS btctme,
  RTRIM(BTUUSR) AS btuusr,
  CASE WHEN BTUDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE BTUDAT END AS btudat,
  BTUTME AS btutme,
  RTRIM(BTPRCL) AS btprcl,
  RTRIM(BTFLG2) AS btflg2,
  RTRIM(BTFLG3) AS btflg3,
  RTRIM(BTFLG4) AS btflg4,
  RTRIM(BTUVER) AS btuver,
  RTRIM(BTPRCD) AS btprcd,
  RTRIM(BTSTAT) AS btstat,
  RTRIM(BTREAS) AS btreas,
  RTRIM(BTARCN) AS btarcn,
  RTRIM(BTARPN) AS btarpn,
  RTRIM(BTARFX) AS btarfx,
  RTRIM(BTEBNK) AS btebnk,
  BTDACN AS btdacn,
  RTRIM(BTDACT) AS btdact,
  RTRIM(BTPAYT) AS btpayt,
  RTRIM(BTFRMT) AS btfrmt,
  RTRIM(BTAPCN) AS btapcn,
  RTRIM(BTFUT1) AS btfut1,
  RTRIM(BTFUT2) AS btfut2,
  RTRIM(BTFUT3) AS btfut3,
  RTRIM(BTFUT4) AS btfut4,
  RTRIM(BTFUT5) AS btfut5,
  BTFUT6 AS btfut6,
  RTRIM(BTFUT7) AS btfut7,
  RTRIM(BTFUT8) AS btfut8,
  RTRIM(BTFUT9) AS btfut9,
  RTRIM(BTFUTA) AS btfuta,
  RTRIM(BTFUTB) AS btfutb,
  RTRIM(BTSPLN) AS btspln,
  RTRIM(BTSSHP) AS btsshp,
  RTRIM(BTSASN) AS btsasn,
  BTSLT AS btslt,
  RTRIM(BTSWK) AS btswk,
  RTRIM(BTRERA) AS btrera,
  RTRIM(BTPPAY) AS btppay,
  RTRIM(BTFRBL) AS btfrbl,
  RTRIM(BTVNDT) AS btvndt,
  RTRIM(BTFUT10) AS btfut10,
  RTRIM(BTFUT11) AS btfut11,
  RTRIM(BTFUT12) AS btfut12,
  RTRIM(BTFUT13) AS btfut13,
  RTRIM(BTFUT14) AS btfut14,
  RTRIM(BTFUT15) AS btfut15,
  BTFUT16 AS btfut16,
  BTFUT17 AS btfut17,
  BTFUT18 AS btfut18,
  RTRIM(BTFLG10) AS btflg10,
  RTRIM(BTFLG11) AS btflg11,
  RTRIM(BTFLG12) AS btflg12,
  RTRIM(BTTMZN) AS bttmzn,
  RTRIM(BTDLRF) AS btdlrf,
  RTRIM(BTIDSP) AS btidsp,
  RTRIM(BTSLTU) AS btsltu,
  RTRIM(BTSTRN) AS btstrn,
  RTRIM(BTRPRL) AS btrprl,
  BTCAMT AS btcamt,
  BTUDPC AS btudpc,
  BTUDAM AS btudam,
  RTRIM(BTPGRP) AS btpgrp,
  RTRIM(BT2DFMT) AS bt2dfmt,
  RTRIM(BTD2DS) AS btd2ds,
  RTRIM(BTLANG) AS btlang,
  RTRIM(BTHIN) AS bthin,
  RTRIM(BTFEDID) AS btfedid,
  RTRIM(BTO2DL) AS bto2dl,
  RTRIM(BTASNM) AS btasnm,
  RTRIM(BTDCLS) AS btdcls,
  RTRIM(BTDSUPP) AS btdsupp,
  BTDEPIN AS btdepin,
  BTMORQ AS btmorq,
  RTRIM(BTDACA) AS btdaca,
  RTRIM(BTDOMS) AS btdoms,
  RTRIM(BTBREF) AS btbref,
  RTRIM(BTSWID) AS btswid,
  RTRIM(BTBLAC) AS btblac,
  RTRIM(BTABAN) AS btaban,
  RTRIM(BTCHIP) AS btchip,
  RTRIM(BT3BNAM) AS bt3bnam,
  RTRIM(BT3CHIP) AS bt3chip,
  RTRIM(BT3SWID) AS bt3swid,
  RTRIM(BT3BLAC) AS bt3blac,
  RTRIM(BT3IBAN) AS bt3iban,
  RTRIM(BT3ADR1) AS bt3adr1,
  RTRIM(BT3ADR2) AS bt3adr2,
  RTRIM(BT3CITY) AS bt3city,
  RTRIM(BT3PROV) AS bt3prov,
  RTRIM(BT3POST) AS bt3post,
  RTRIM(BT3CRYC) AS bt3cryc,
  RTRIM(BT3CONT) AS bt3cont,
  RTRIM(BT3PHON) AS bt3phon,
  RTRIM(BT3FAXN) AS bt3faxn,
  RTRIM(BTFCUR) AS btfcur,
  RTRIM(BTEBNM) AS btebnm,
  BTFFTH AS btffth,
  RTRIM(BTXBNAM) AS btxbnam,
  RTRIM(BTXCHIP) AS btxchip,
  RTRIM(BTXSWID) AS btxswid,
  RTRIM(BTXBLAC) AS btxblac,
  RTRIM(BTXIBAN) AS btxiban,
  RTRIM(BTXADR1) AS btxadr1,
  RTRIM(BTXADR2) AS btxadr2,
  RTRIM(BTXCITY) AS btxcity,
  RTRIM(BTXPROV) AS btxprov,
  RTRIM(BTXPOST) AS btxpost,
  RTRIM(BTXCRYC) AS btxcryc,
  RTRIM(BTXCONT) AS btxcont,
  RTRIM(BTXPHON) AS btxphon,
  RTRIM(BTXFAXN) AS btxfaxn,
  RTRIM(BTGMT) AS btgmt,
  RTRIM(BTMRPN) AS btmrpn,
  RTRIM(BTEZAI) AS btezai,
  RTRIM(BTFUT19) AS btfut19,
  RTRIM(BTFUT20) AS btfut20,
  RTRIM(BTFUT21) AS btfut21,
  RTRIM(BTFUT22) AS btfut22,
  RTRIM(BTFUT23) AS btfut23,
  RTRIM(BTFUT24) AS btfut24,
  RTRIM(BTFUT25) AS btfut25,
  RTRIM(BTFUT26) AS btfut26,
  RTRIM(BTFUT27) AS btfut27,
  BTFUT28 AS btfut28,
  BTFUT29 AS btfut29,
  BTFUT30 AS btfut30
FROM LGDAT.VEND
