-- DS.FS 30.05.2016 J.Fes
Select 
 pd.puid As DataSetPuid,
 -- #New 20.03.2019/J.Fes Exa: 'UGPART' 'JTPART'
 rn.pval_0             As NamedRef_Reference,
 rev.pseq              As pd_pseq,
 imv.pmachine_type     As imv_pmachine_type,
 imv.pvolume_name      As imv_pvolume_name,
 imv.punix_path_name   As imv_punix_path_name,
 imv.pwnt_path_name    As imv_pwnt_path_name,
 imf.psd_path_name     As imf_psd_path_name,
 imf.pfile_name        As imf_pfile_name,
 pao.plast_mod_date    As imf_lastmoddat
From
 infodba.PDATASET pd
 Left Join infodba.PREVISIONS       rev On (rev.puid = pd.rrev_chain_anchoru)
 Left Join infodba.PREF_LIST        rl  On (rl.puid = rev.pvalu_0)
 Left Join infodba.PREF_NAMES       rn  On (rl.puid = rn.puid And rl.pseq = rn.pseq)
 Left Join infodba.PIMANFILE        imf On (imf.puid = rl.pvalu_0)
 Left Join infodba.PIMANVOLUME      imv On (imv.puid = imf.rvolume_tagu)
 Left Join infodba.PPOM_APPLICATION_OBJECT pao On (pao.puid = imf.puid)
where
 pd.puid = :para_puid
 and rev.pseq <= :para_rev_pseq
 and rn.pval_0 in ('UGPART','#TCSQL_PREF_NAMES_pval_0#')
order by
 rev.pseq asc

