SELECT
  RTRIM(AVPART) AS avpart,
  RTRIM(AVDES1) AS avdes1,
  RTRIM(AVDES2) AS avdes2,
  RTRIM(AVDES3) AS avdes3,
  RTRIM(AVUNTI) AS avunti,
  RTRIM(AVMAJG) AS avmajg,
  RTRIM(AVMING) AS avming,
  RTRIM(AVMAJS) AS avmajs,
  RTRIM(AVMINS) AS avmins,
  RTRIM(AVGLCD) AS avglcd,
  RTRIM(AVGLED) AS avgled,
  RTRIM(AVHARM) AS avharm,
  RTRIM(AVCLSS) AS avclss,
  RTRIM(AVFUT3) AS avfut3,
  RTRIM(AVFUT4) AS avfut4,
  RTRIM(AVFUT5) AS avfut5,
  RTRIM(AVFUTC) AS avfutc,
  RTRIM(AVFUTD) AS avfutd,
  RTRIM(AVUPCC) AS avupcc,
  AVGTIN AS avgtin,
  AVNWHT AS avnwht,
  RTRIM(AVNWUN) AS avnwun,
  AVSVOL AS avsvol,
  RTRIM(AVSVUN) AS avsvun,
  RTRIM(AVENGC) AS avengc,
  RTRIM(AVREVL) AS avrevl,
  CASE WHEN AVRDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVRDAT END AS avrdat,
  RTRIM(AVCOIL) AS avcoil,
  RTRIM(AVFUT9) AS avfut9,
  RTRIM(AVMSPC) AS avmspc,
  AVSLIF AS avslif,
  RTRIM(AVDPLT) AS avdplt,
  RTRIM(AVUVER) AS avuver,
  RTRIM(AVCATA) AS avcata,
  RTRIM(AVFEDC) AS avfedc,
  RTRIM(AVTAXR) AS avtaxr,
  RTRIM(AVCUST) AS avcust,
  RTRIM("AVCPT#") AS "avcpt#",
  RTRIM("AVREV#") AS "avrev#",
  RTRIM(AVFUT7) AS avfut7,
  RTRIM(AVFUT8) AS avfut8,
  RTRIM(AVFUTB) AS avfutb,
  CASE WHEN AVLDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVLDAT END AS avldat,
  RTRIM(AVTYPE) AS avtype,
  RTRIM(AVFUTK) AS avfutk,
  RTRIM(AVFUTN) AS avfutn,
  RTRIM(AVPPAP) AS avppap,
  RTRIM(AVCUSR) AS avcusr,
  CASE WHEN AVCDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVCDAT END AS avcdat,
  AVCTME AS avctme,
  RTRIM(AVUUSR) AS avuusr,
  CASE WHEN AVUDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVUDAT END AS avudat,
  AVUTME AS avutme,
  RTRIM(AVSIZC) AS avsizc,
  RTRIM(AVSTLC) AS avstlc,
  RTRIM(AVCOLC) AS avcolc,
  RTRIM(AVASSC) AS avassc,
  RTRIM(AVSASC) AS avsasc,
  RTRIM(AVLCOIL) AS avlcoil,
  RTRIM(AVGDFL) AS avgdfl,
  RTRIM(AVVDFL) AS avvdfl,
  RTRIM(AVWOQF) AS avwoqf,
  RTRIM(AVNMFC) AS avnmfc,
  AVFUTH AS avfuth,
  AVFUTI AS avfuti,
  RTRIM(AVFUTL) AS avfutl,
  RTRIM(AVFUTM) AS avfutm,
  RTRIM(AVFUTP) AS avfutp,
  CASE WHEN AVFUTQ IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUTQ END AS avfutq,
  CASE WHEN AVFUTR IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUTR END AS avfutr,
  AVPRUN AS avprun,
  AVTOTP AS avtotp,
  RTRIM(AVDISC) AS avdisc,
  RTRIM(AVINVT) AS avinvt,
  RTRIM(AVBK01) AS avbk01,
  RTRIM(AVBILL) AS avbill,
  RTRIM(AVBK04) AS avbk04,
  RTRIM(AVBK06) AS avbk06,
  RTRIM(AVOLDD) AS avoldd,
  RTRIM(AVOLDD2) AS avoldd2,
  RTRIM(AVLOTF) AS avlotf,
  RTRIM(AVSERF) AS avserf,
  RTRIM(AVORIG) AS avorig,
  RTRIM(AVPLAN) AS avplan,
  AVMINQ AS avminq,
  AVMAXQ AS avmaxq,
  AVLEAD AS avlead,
  RTRIM(AVSCDT) AS avscdt,
  AVESTV AS avestv,
  RTRIM(AVCNTR) AS avcntr,
  RTRIM(AVUNTP) AS avuntp,
  AVLVL AS avlvl,
  AVMOQT AS avmoqt,
  AVPACK AS avpack,
  RTRIM(AVPACU) AS avpacu,
  AVPRPT AS avprpt,
  RTRIM(AVKITC) AS avkitc,
  RTRIM(AVPROC) AS avproc,
  RTRIM(AVLRSP) AS avlrsp,
  AVLRSC AS avlrsc,
  RTRIM(AVLRSF) AS avlrsf,
  RTRIM(AVLRMP) AS avlrmp,
  AVLRMC AS avlrmc,
  RTRIM(AVLRMF) AS avlrmf,
  RTRIM(AVLWSP) AS avlwsp,
  AVLWSC AS avlwsc,
  RTRIM(AVLWSF) AS avlwsf,
  RTRIM(AVLCSP) AS avlcsp,
  AVLCSC AS avlcsc,
  RTRIM(AVLCSF) AS avlcsf,
  RTRIM(AVLCMP) AS avlcmp,
  AVLCMC AS avlcmc,
  RTRIM(AVLCMF) AS avlcmf,
  AVLSSC AS avlssc,
  RTRIM(AVLSSF) AS avlssf,
  RTRIM(AVLSMP) AS avlsmp,
  AVLSMC AS avlsmc,
  RTRIM(AVLSMF) AS avlsmf,
  AVMPCK AS avmpck,
  RTRIM(AVMPKU) AS avmpku,
  AVALTF AS avaltf,
  RTRIM(AVDBUY) AS avdbuy,
  RTRIM(AVFUT1) AS avfut1,
  RTRIM(AVFUT2) AS avfut2,
  AVFUT6 AS avfut6,
  RTRIM(AVFUTA) AS avfuta,
  AVFUTG AS avfutg,
  RTRIM(AVRECU) AS avrecu,
  AVFTMF AS avftmf,
  RTRIM(AVRECC) AS avrecc,
  RTRIM(AVFUTJ) AS avfutj,
  RTRIM(AVABCC) AS avabcc,
  RTRIM(AVCORG) AS avcorg,
  AVPERC AS avperc,
  AVOPTR AS avoptr,
  AVMULT AS avmult,
  AVMINR AS avminr,
  AVSHRK AS avshrk,
  RTRIM(AVSTAT) AS avstat,
  RTRIM(AVREAS) AS avreas,
  CASE WHEN AVSPDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVSPDT END AS avspdt,
  CASE WHEN AVBBDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVBBDT END AS avbbdt,
  RTRIM(AVPSOR) AS avpsor,
  RTRIM(AVFUTO) AS avfuto,
  RTRIM(AVDRWS) AS avdrws,
  RTRIM(AVDRWL) AS avdrwl,
  RTRIM(AVDENC) AS avdenc,
  RTRIM(AVDREL) AS avdrel,
  CASE WHEN AVDDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVDDAT END AS avddat,
  RTRIM(AVFUTE) AS avfute,
  RTRIM(AVDRWS2) AS avdrws2,
  RTRIM(AVDRWL2) AS avdrwl2,
  RTRIM(AVDENC2) AS avdenc2,
  RTRIM(AVDREL2) AS avdrel2,
  CASE WHEN AVDDAT2 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVDDAT2 END AS avddat2,
  RTRIM(AVFUTF) AS avfutf,
  RTRIM(AVSTCL) AS avstcl,
  RTRIM(AVVLCD) AS avvlcd,
  AVSPPP AS avsppp,
  RTRIM(AVSPPC) AS avsppc,
  AVMPPP AS avmppp,
  RTRIM(AVMPPC) AS avmppc,
  RTRIM(AVFLG01) AS avflg01,
  RTRIM(AVFLG02) AS avflg02,
  RTRIM(AVFLG03) AS avflg03,
  RTRIM(AVFLG04) AS avflg04,
  RTRIM(AVFLG05) AS avflg05,
  RTRIM(AVFLG06) AS avflg06,
  RTRIM(AVFLG07) AS avflg07,
  RTRIM(AVFLG08) AS avflg08,
  RTRIM(AVFLG09) AS avflg09,
  RTRIM(AVFLG10) AS avflg10,
  RTRIM(AVFUT01) AS avfut01,
  RTRIM(AVFUT02) AS avfut02,
  RTRIM(AVFUT03) AS avfut03,
  RTRIM(AVFUT04) AS avfut04,
  RTRIM(AVFUT05) AS avfut05,
  RTRIM(AVFUT06) AS avfut06,
  RTRIM(AVFUT07) AS avfut07,
  RTRIM(AVFUT08) AS avfut08,
  RTRIM(AVFUT09) AS avfut09,
  RTRIM(AVFUT10) AS avfut10,
  RTRIM(AVFUT11) AS avfut11,
  RTRIM(AVFUT12) AS avfut12,
  RTRIM(AVFUT13) AS avfut13,
  RTRIM(AVFUT14) AS avfut14,
  RTRIM(AVFUT15) AS avfut15,
  RTRIM(AVFUT16) AS avfut16,
  RTRIM(AVFUT17) AS avfut17,
  RTRIM(AVFUT18) AS avfut18,
  RTRIM(AVFUT19) AS avfut19,
  RTRIM(AVFUT20) AS avfut20,
  RTRIM(AVFUT21) AS avfut21,
  RTRIM(AVFUT22) AS avfut22,
  RTRIM(AVFUT23) AS avfut23,
  RTRIM(AVFUT24) AS avfut24,
  RTRIM(AVFUT25) AS avfut25,
  AVFUT26 AS avfut26,
  AVFUT27 AS avfut27,
  AVFUT28 AS avfut28,
  AVFUT29 AS avfut29,
  AVFUT30 AS avfut30,
  AVFUT31 AS avfut31,
  AVFUT32 AS avfut32,
  AVFUT33 AS avfut33,
  AVFUT34 AS avfut34,
  AVFUT35 AS avfut35,
  CASE WHEN AVFUT36 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUT36 END AS avfut36,
  CASE WHEN AVFUT37 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUT37 END AS avfut37,
  CASE WHEN AVFUT38 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUT38 END AS avfut38,
  CASE WHEN AVFUT39 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUT39 END AS avfut39,
  CASE WHEN AVFUT40 IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVFUT40 END AS avfut40,
  AVFUT41 AS avfut41,
  AVFUT42 AS avfut42,
  AVFUT43 AS avfut43,
  AVFUT44 AS avfut44,
  AVFUT45 AS avfut45,
  RTRIM(AVUDFT) AS avudft,
  RTRIM(AVFRML) AS avfrml,
  RTRIM(AVHAZA) AS avhaza,
  AVLLED AS avlled,
  RTRIM(AVDBAC) AS avdbac,
  RTRIM(AVSCDPT) AS avscdpt,
  RTRIM(AVFIFO) AS avfifo,
  RTRIM(AVANTID) AS avantid,
  RTRIM(AVSUBT) AS avsubt,
  RTRIM(AVPRCL) AS avprcl,
  RTRIM(AVOTP) AS avotp,
  RTRIM(AVCBYL) AS avcbyl,
  RTRIM(AVSRVC) AS avsrvc,
  RTRIM(AVSPAL) AS avspal,
  RTRIM(AVPGRP) AS avpgrp,
  RTRIM(AVUPN) AS avupn,
  RTRIM(AVUEQG) AS avueqg,
  RTRIM(AVMFRC) AS avmfrc,
  RTRIM(AVATFR) AS avatfr,
  RTRIM(AVBBKRQ) AS avbbkrq,
  RTRIM(AVMLBLC) AS avmlblc,
  RTRIM(AVROHSCT) AS avrohsct,
  RTRIM(AVROHSCF) AS avrohscf,
  RTRIM(AVBBKINT) AS avbbkint,
  RTRIM(AVMFCOR) AS avmfcor,
  RTRIM(AVMFPOR) AS avmfpor,
  RTRIM(AVMFRMC) AS avmfrmc,
  RTRIM(AVMFRMS) AS avmfrms
FROM LGDAT.STKMM
