> (The OP would be you, right?)

Yup. That's what makes me the expert on what his question meant.

> However, you cannot sequentially read a UNIX directory.

Bummer indeed. I need a module that can sort out four cases, given a "z/OS file 
name."

- It is a sequential conventional dataset or PDS member.
- It is a PDS(E): return all of the effective names, i.e., for a PDS FOO.BAR, 
return FOO.BAR(MEMBER1), FOO.BAR(MEMBER2), ...
- It is a regular HFS file
- It is an HFS directory: return all of the effective names, i.e., for foo/bar, 
return foo/bar/file1, foo/bar/file2, ...

Oh yeah, with wildcard masking on the file or member names. 

It is a much bigger job than it ought to be. It is a Sherlock Holmes job 
figuring out which of the four cases applies. Not the biggest programming job 
ever -- yes, I have all of the little tricks figured out -- but bigger than it 
ought to be. 

How many times has this wheel been re-invented? 

Yeah, I could use DESERV for the PDS instead of reading the directory, but I 
would have to build a C->Assembler front-end to do so. Not much different than 
just doing the job in C. A little harder to maintain, because there is logic in 
two places (and I have both skill sets, but a future maintainer might not).

The PDS thing is kind of fun in C++. I have a PDS directory entry class that 
has a member that knows how to get the next entry in the block:

inline int PDSdirEntryLen() { return (C.numberOfUserDataHalfwords * 2) + 
sizeof(memberName) + sizeof(C) + sizeof(firstRecord); }

inline PDSdirEntry *PDSdirEntryNext() { return reinterpret_cast<PDSdirEntry *>( 
PDSdirEntryLen() + reinterpret_cast<char *>(this) ); }  

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of Paul Gilmartin
Sent: Thursday, September 06, 2012 6:45 PM
To: [email protected]
Subject: Re: Anyone know how to copy a PDS directory as a flat file?

On Thu, 6 Sep 2012 15:30:57 -0700, Charles Mills wrote:

>Nope, the below is one of the answers to the OP's question.
>
(The OP would be you, right?)

>It also works for PDSE, believe it or not.
>
It says that in Using Data Sets, 3.8.11 Reading a PDSE Directory:

    You can read a PDSE directory sequentially just by opening the data set 
(without using positioning macros) and reading it.
        ...
        If you also want to read the keys (the name of the last member in that 
block), use BSAM and specify KEYLEN=8. 

It fakes it all.  It even fakes keys.  But does it return a usable TTR; one 
that can be used in a subsequent POINT?
            ...
        However, you cannot sequentially read a UNIX directory.

Bummer.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to