-- Me.Ir_DataSets_NamedRef_Attr_SQL_cmd.CommandText: /* IR UG-DS 28.10.09 J.Fes/T.Nestler */

Select
  pd.puid               As DataSetPuid,
  rn.pval_0             As TypeX,
  s.psite_id            AS OwningSite_TC_pSite_ID,
  wso.pobject_name      As DataSetName,
  wso.pobject_desc      As DataSetDescription, -- description
  pdt.pdatasettype_name As DataSetType,        -- UGMASTER.. UGPART.. UGALTREP..
  ptype.ptype_name      As DataSetPTYPE_NAME,  -- neu 8.2.09
  pu_owni_ds.puser_id   As DataSetOwningUser,
  pg_owni_ds.pname      As DataSetOwningGroup,
  pao.pcreation_date    As DataSetCreateDate,
  pu_lmod_ds.puser_id   As DataSetLastModUser,
  pao.plast_mod_date    As DataSetLastModDate,
  imv.pvolume_name      As imv_pvolume_name,    -- volume name
  imv.pmachine_type     As imv_pmachine_type,   -- Maschinen Type 0=winnt 1=
  imv.punix_path_name   As imv_punix_path_name, -- vol_DP unix pathname
  imv.pwnt_path_name    As imv_pwnt_path_name,  -- vol_DP windows
  imf.psd_path_name     As imf_psd_path_name,
  imf.pfile_name        As imf_pfile_name
From
  infodba.PDATASET pd,
  infodba.PPOM_OBJECT o,
  infodba.PPOM_IMC s,
  infodba.PIMANRELATION pr,
  infodba.PIMANTYPE ptype,
  infodba.PWORKSPACEOBJECT wso,
  infodba.PPOM_APPLICATION_OBJECT pao,
  infodba.PDATASETTYPE pdt,
  infodba.PPOM_USER pu_owni_ds,  -- DS OwningUser
  infodba.PPOM_USER pu_lmod_ds,  -- DS LastModUser
  infodba.PPOM_GROUP pg_owni_ds, -- DS OwningGroup
  infodba.PREVISIONS rev,
  infodba.PREF_NAMES_0 rn,
  infodba.PREF_LIST_0 rl,
  infodba.PIMANFILE imf,
  infodba.PIMANVOLUME imv
Where
  pr.rsecondary_objectu   = pd.puid
and ptype.puid            = pr.rrelation_typeu
and pd.rdataset_typeu     = pdt.puid
and wso.puid              = pd.puid
and pu_owni_ds.puid       = pao.rowning_useru
and pu_lmod_ds.puid       = pao.rlast_mod_useru
and pg_owni_ds.puid       = pao.rowning_groupu
and rl.puid               = pd.puid
and imf.puid              = rl.pvalu_0
and imv.puid              = imf.rvolume_tagu
and pao.puid              = rev.pvalu_0
and rn.pseq               = rl.pseq
and pd.rrev_chain_anchoru = rev.puid
and rev.pvalu_0           = rn.puid
and pd.puid               = o.puid(+)
and o.rowning_siteu       = s.puid(+)
and
  (
    pr.rprimary_objectu = 'hEI9QuVdTzDfjB'
  -- and rn.pval_0         = 'UGPART'  -- nur UGPART
  and rev.pseq          = 0         -- n.last Doc
  )