I don't know if any of the previous responses satisfied your need. Another approach would be to create a second DCB (PS, BSAM, RECFM=U, and BLKSIZE=32760). Open the DCB, read the first block, and close the DCB. Examine the data for whatever attributes you like (such as correct BDW and one or more correct RDWs). Set some flags (such as "definitely not VB") and save some values (such as length of first block). After opening your primary DCB, check the fields that are filled in (such as DSORG, LRECL, BLKSIZE) for consistency with your flags and saved values. Not only will this let you catch the case you described (a PDS directory would not pass the BDW/RDW check) but possibly other user mistakes such as records larger than blocksize, FB blocksize (either DSCB or actual) not a multiple of LRECL, F or FB blocks shorter than LRECL, etc
Thomas David Rivers <[EMAIL PROTECTED]> wrote: Hi Bill... Well - yes - you've hit the nail on the head - the routines are very confused because they are expecting to see VB-type records (with a BDW and RDW) and they are not. The program uses BSAM I/O. The issue here is that the program expects to not be directed to a PDS, and when that accidently happens - things go, as you mention, alarmingly wrong. What I'm looking for is some way for the program to say "Hey! This isn't a sequentional VB file at all." Instead of miserably blowing up. As I mentioned before, I tried looking the DSORG in the DCB, but that indicates PS (because the PDS was opened with a PS DCB.) So - is there another way to tell if the file I'm trying to read with BSAM I/O (doing my own unblocking of the VB records) is at all reasonable? Someone else suggested using DYNALLOC to query the organization of the file before the OPEN... is there a way to accomplish this after the OPEN? Then - when the user points the program to a PDS instead of a nice sequential file (or PDS member), things don't just "blow up", but can simply inform the user that is an invalid file. --------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less. ---------------------------------------------------------------------- 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