Page 1 of 1

Question about SYSDSN

PostPosted: Fri Jun 28, 2013 12:44 am
by anand4u237
Hey guys,

I came to know that SYSDSN can be used to verify whether a dataset can be existing or not. Can anybody explain a little about it and how can I use it in programming to find out a dataset is found or not.

Thanks
anand

Re: Question about SYSDSN

PostPosted: Fri Jun 28, 2013 1:01 am
by Akatsukami
SYSDSN is a Rexx TSO/E external function, and as such can be used in Rexx scripts running in the TSO environment (foreground or background). It returns a message describing the availability of the data set whose name is passsed to it as an argument. Read more about it, including all messages returned, here.

Re: Question about SYSDSN

PostPosted: Fri Jun 28, 2013 5:32 pm
by NicC
I googled 'sysds' and the first page of results was full of links to the information that you need? So why did you post? After 2 years here you should know that the forum should be a place of 'last resort'.

Re: Question about SYSDSN

PostPosted: Sun Jun 30, 2013 3:57 pm
by anand4u237
Hi,

I am using the following code in my prog but it seems not working. Please help

Where &DSNAME = DATA.SET.LIB


IF &DATEFND = Y THEN +
IF SYSDSN("&DSNAME") # 'OK' THEN +
DO
SET &MESG = Dataset &DSNAME is not availabe for the mentioned date.


Thanks
Anand

Re: Question about SYSDSN

PostPosted: Sun Jun 30, 2013 6:49 pm
by NicC
You should know by now that "it is not working" means absolutely nothing unless you provide the information about HOW it is not working - syntax error, abending, wrong data returned or what.

Re: Question about SYSDSN

PostPosted: Sun Jun 30, 2013 7:38 pm
by Akatsukami
Of course it is not working; the code you show is CLIST, and SYSDSN is a Rexx function. Learn the difference.

Re: Question about SYSDSN

PostPosted: Sun Jun 30, 2013 8:28 pm
by steve-myers
Actually, it's not even proper CLIST. The topic starter should carefully read the topic for &SYSDSN (not SYSDSN) in TSO/E CLISTs for their z/OS release. I do not think # is a valid comparator in CLIST.

&SYSDSN returns text that can be used in a message. I would suggest something like this -

SET RC = &SYSDSN('&DSNAME')
IF &RC NE OK THEN +
WRITE &DSNAME: &RC

By using NE as a comparator the topic starter avoids the issue about the character set with his keyboard. Many 3270 emulators allow the ^ (Shift-6) character to be used in place of the EBCDIC ¬ character, but it may not be worth the effort.

Re: Question about SYSDSN

PostPosted: Sun Jun 30, 2013 9:01 pm
by steve-myers
For what it's worth, the wc3270 emulator is not a terminal emulator that let's you use the ^ character in place of the ¬ character, though it does display ¬ if it is present in data sent to it.

Re: Question about SYSDSN

PostPosted: Thu Jul 04, 2013 7:52 am
by anand4u237
Thanks a lot for the post Steve your solution works!

Re: Question about SYSDSN

PostPosted: Thu Jul 04, 2013 9:45 am
by steve-myers
Thanks for the update.