I only tried it with an existing z/OS data set that was sequential and thus would work with cat. It wouldn't work with a non-sequential data set and I should have mentioned that.
Lionel B. Dyck <sdg>< Website: http://www.lbdsoftware.com "Worry more about your character than your reputation. Character is what you are, reputation merely what others think you are." - John Wooden -----Original Message----- From: IBM Mainframe Discussion List <[email protected]> On Behalf Of Kirk Wolf Sent: Tuesday, July 2, 2019 9:21 AM To: [email protected] Subject: Re: USS script : how to test that a MVS Dataset exists ? Hi Lionel, Did you try this with an existing zFS cluster? I get the same error: > cat //'dovetail.usrloc.zfs' cat: //dovetail.usrloc.zfs: EDC5049I The specified file name could not be located. FWIW, you can use the Co:Z "catsearch" shell command, which is a shell command interface to IGGCSI00, etc. (free to use under our Community License). For example: > count=$(catsearch dovetail.usrloc.zfs | wc -l ) echo $count 1 Back to the original problem - why not use "mount" and redirect stderr somewhere to a temp file that your script can look at. There might be errors mounting other than the data set not existing. Kirk Wolf http://dovetail.com PS> There seems to be a legitimate problem with the error returned by "cat". If I try to read the zfs using the Co:Z "fromdsn" shell command (which opens and reads using fopen() / fread(): > fromdsn //dovetail.usrloc.zfs fromdsn(DOVETAIL.USRLOC.ZFS)[E]: DatasetHandler: Error in fopen(//'DOVETAIL.USRLOC.ZFS', rb,type=record,noseek,recfm=*) - EDC5041I An error was detected at the system level when opening a file. (errno2=0xC00A0022) This is an expected error, since reading VSAM with fread() is not supported by z/OS for linear data sets. But doing this on a non-existing file results in: >fromdsn foo.bar fromdsn(FOO.BAR)[E]: DatasetHandler: Error in fopen(//'FOO.BAR', rb,type=record,noseek,recfm=*) - EDC5049I The specified file name could not be located. (errno2=0xC00B0641) If you look up the errno2 (reason codes) with bpxmtext, these look right. You can get cat to print out the errno2 with: >export _EDC_ADD_ERRNO2=1 /u/vendor/kirk>/bin/cat //'DOVETAIL.USRLOC.ZFS' cat: //DOVETAIL.USRLOC.ZFS: EDC5049I The specified file name could not be located. (errno2=0xC00B0641) >bpxmtext c00b0641 JrEdc1opsElocate01: The filename argument passed to fopen() or freopen() specified dsname syntax. The mode argument specified read. Allocation of a ddname for the dsname was attempted, but SVC 99 failed with error code 0x1708. The data set name could not be located. You cannot use read mode for a data set that does not exist. Action: Correct the application. Source: edc1opst.c That's just weird. On Tue, Jul 2, 2019 at 8:43 AM Lionel B Dyck <[email protected]> wrote: > You could use the cat "//'zos.dsname'" and it will either work on you > will get a error message: > > /u/user/cat "//'USER.TEST'" > cat: //'USER.TEST': EDC5049I The specified file name could not be > located. > > > Lionel B. Dyck <sdg>< > Website: http://www.lbdsoftware.com > > "Worry more about your character than your reputation. Character is > what you are, reputation merely what others think you are." - John > Wooden > > -----Original Message----- > From: IBM Mainframe Discussion List <[email protected]> On > Behalf Of [email protected] > Sent: Tuesday, July 2, 2019 8:37 AM > To: [email protected] > Subject: USS script : how to test that a MVS Dataset exists ? > > Hello,I would like to "test" if a MVS Dataset exist (is catalogued) > during the /etc/rc script. > As far as I know, since /etc/rc script run during USS initialisation, > TSO services are not yet available. So I cannot use the "tso" Unix > command to issue a LISTCAT. > Actualy my need is to perform a mount command in this process. But I > do not want to return Error messages, if the HFS/ZFS doesn't exist. > That's why I need to test that the dataset is catalogued/exist before > calling the Mount service. > > Do you have any idea ? > Regards,Laurent > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, send > email to [email protected] with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, send > email to [email protected] with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
