In a message dated 4/24/2006 1:41:01 P.M. Central Daylight Time,  
[EMAIL PROTECTED] writes:

>I've got a program that opens a VB PDS  (RECFM=VB,BLKSIZE=2550,LRECL=255).

>But - note that I said it opens  the PDS, not a member of the PDS.  That
>open succeeds, and  presumably, the program will merrily try to
>read the PDS directory as  Format-V records.

>So - the first read succeeds, and it gets these  bytes back for
>the first 6:

>    000EFFFF   FFFF
>        | BDW  | | RDW  ....


The first block in a PDS is the first block of the directory, which has  a 
fixed format (lrecl=blksize=256 with 8-byte keys).  Presumably your  program is 
not trying to do a Read Key and Data but rather a Read Data CCW, so  you do 
not read the key but instead read only the first data block in the  directory.  
The first 2 bytes in the data area of a PDS directory block  are the number of 
bytes in that 256-byte block that are used.  You show  000E.  I did an 
IMASPZAP dump of a CNTL PDS of mine and found two  blocks with 00FE in the 
first two 
bytes, and the third block had  X'000EFFFFFFFFFFFFFFFF00000000' at the 
beginning.  The 8 bytes of FF are  a fake member name of all X'FF' so that it 
will 
always be last when all the  member names are sorted into ascending sequence.  
A PDS directory is  supposed to have its member names in that sequence.  In my 
case, the 000E  is the correct number of bytes used in this block, as the 
minimum length of  one entry is 8 for the member name, 3 more for the relative 
TTR within the PDS  where the member begins, and 1 byte of flags.  The minimum 
entry length  is then 12.  Two more bytes for the obligatory 2-byte block 
length at the  beginning yields 14 bytes.  A block that begins as this one does 
is 
a  block indicating the last directory block with any meaningful information 
in  it, and in this case the meaningful info is the fake member name showing 
the  end of the directory's list of members.  There are more blocks in my  
directory after this one, and they are all X'00'.
 
It looks as if your PDS is completely empty.  That would explain why  you see 
000EFFFFFFFF in the first 6 bytes.  The read CCW does not move  any bytes 
around, change them, or interpret them.  It reads what is on  the track.  Then 
the VBS access method will assume that the first 2 bytes  are the block length, 
then 2 reserved bytes, then 2 RDW bytes, etc.  In  other words, because you 
told QSAM to read a PDS directory block and to treat  it as VBS data, you have 
thoroughly confused not only the access method but  also yourself.
 
You need to put a lot more logic into your program; i.e., be sensitive to  
file organization type (DSORG=PO for a PDS), etc.  I cannot begin to  suggest 
what extra logic you should add, since I do not know the purpose of  your 
program or why you want to read a PDS with it including its  directory.
 
A much better way to read through a PDS is with BSAM, which can also read  
through any other data set organization.  But you have to code more logic  
after 
each block is read in with the READ/CHECK macros.
 
>what's a program "to do" with what the user types.
I cannot understand the meaning of this phrase.

>Should it look  at the lrecl/blksize in the DCB and decide that
>this doesn't make  sense?  What if it did make sense - then what?
At the very least, your program must look at the data set  organization.  
"Then what" depends on what you want your program to do,  which I don't know.

>Or - is there a way to know this is a bunch of  bytes from a
>PDS directory... and this READ doesn't make sense?
Your program can know that this bunch of bytes is a PDS directory because  it 
is the first block in the input data of a PDS.  The end of the  directory is 
marked by an end of file record.  That will probably confuse  your program, 
too.  Then the first block of the first member begins  after the end of file 
record, unless the first member has been  deleted after the second member was 
added, in which case what you  will read next is what used to be the first 
member, which also ends with  another end of file record.  More confusion.
 
I would suggest a complete redesign of your program beginning with a  
thorough understand of what your program is supposed to accomplish, followed  
by 
research into the internals of a PDS.



Bill  Fairchild

----------------------------------------------------------------------
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

Reply via email to