Hello Dave Rivers, When I first read your post I thought you were asking how to read a PDS directory....but that isnt what you want to do is it. You want to protect your VB reading program when it is accidentally handed a PDS.
I cant answer that, coz I am still focused on the read the PDS bit:
Here is some REXX code that can interpret PDS member directory.
Extract_Member_Names: Procedure Expose dsname member. ttr. alist.
Parse Arg mem_srch
member =
member. =
alist. =
ttr. =
mcnt = 0
dsinfo = Listdsi(dsname "DIRECTORY")
If sysdsorg = "PO" & sysmembers > 0 Then Do
"ALLOC F(PDSDIR) DS(" || dsname || ") SHR REUS DSORG(PS)" ,
"LRECL(256) RECFM(F B)"
"EXECIO 1 DISKR PDSDIR"
Pull dblk
blen = C2d(Substr(dblk,1,2))
mem = Substr(dblk,3,8)
i = 3 /* index into block */
Do While mem ¬= 'FFFFFFFFFFFFFFFF'x
Do While mem ¬= 'FFFFFFFFFFFFFFFF'x & i < blen
ttr = C2x(Substr(dblk, i+8 ,3 ))
flag = Substr(dblk, i+11 ,1 )
ulen = C2d(Bitand(flag,'1F'x)) * 2
aflag = Bitand(flag,'80'x)
mem = Strip(mem,"B")
If aflag = '80'x Then Do
alist.ttr = alist.ttr mem
End
Else Do
If Length(Strip(mem_Srch)) = 0 ,
| Pos(mem_srch,mem) > 0 Then Do
mcnt = mcnt + 1
member.mcnt = mem
ttr.mcnt = ttr
End
End
i = i + 12 + ulen
mem = Substr(dblk,i,8)
End
If mem = 'FFFFFFFFFFFFFFFF'x Then Leave
"EXECIO 1 DISKR PDSDIR"
If rc = 0 Then Do
Pull dblk
blen = C2d(Substr(dblk,1,2))
mem = Substr(dblk,3,8)
i = 3 /* index into block */
End
Else Leave
End
member.0 = mcnt
ttr.0 = mcnt
"EXECIO 0 DISKR PDSDIR ( FINIS"
"FREE F(PDSDIR)"
End
Return mcnt
Regards
Bruce Hewson
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

