Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Usage of SYSDSN to find whether a ps or PDS exists

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Fri Aug 10, 2007 3:12 pm    Post subject: Usage of SYSDSN to find whether a ps or PDS exists
Reply with quote

hi,
Can anybody help?
My requiremnt is to find whether a particular pds or ps exists,and the name of the pds or ps is to be taken as input from the user.
I have used the following code but it is not working properly
Code:

SAY 'ENTER A FILE NAME'             
PARSE UPPER PULL FILE               
SAY SYSDSN(FILE)                   
IF SYSDSN(FILE)='OK'  THEN         
 SAY 'FILE EXISTS'       
Even when Iam giving an existing pds Iam getting a messsage saying
'DATASET NOT FOUND'
Back to top
View user's profile Send private message

saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Aug 10, 2007 3:38 pm    Post subject:
Reply with quote

Hi shchan,

The Code is working fine for me , Can you post the Trace output .



Thanks
Sai
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Fri Aug 10, 2007 4:25 pm    Post subject:
Reply with quote

Hi Sai,
this is the following output
Code:

3 *-* SAY 'ENTER A FILE NAME' 
        >>>   "ENTER A FILE NAME"   
 ENTER A FILE NAME     
4 *-* PARSE UPPER PULL FILE             
vv8.rexx.exec                                 
        >>>   "VV8.REXX.EXEC"                 
      5 *-* /*SAY FILE*/                     
      6 *-* /*SAY SYSDSN("'VV8.REXX.EXEC'")*/
      7 *-* /*FILE="'VV8.JCLS.EXAMPLES'"*/   
      8 *-* /*NAME="'FILE'"*/                 
      9 *-* /*SAY NAME*/                     
     10 *-* SAY SYSDSN(FILE)                 
        >>>   "DATASET NOT FOUND"             
 DATASET NOT FOUND                           
     11 *-* IF SYSDSN(FILE)='OK'             
        >>>   "0"                             
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Aug 10, 2007 4:45 pm    Post subject:
Reply with quote

Hi Shchan,

Give TRACE I in the first line and execute the code. You will get the output like this

Code:
   123 *-* SAY 'ENTER A FILE NAME'             
        >L>   "ENTER A FILE NAME"               
 ENTER A FILE NAME                             
    124 *-* PARSE UPPER PULL FILE               
a0shfufdf                                       
        >>>   "A0SHFUFDF"                       
    125 *-* SAY SYSDSN(FILE)                   
        >V>   "A0SHFUFDF"                       
 INVALID DATA SET NAME, A0SHFUFDF               
        >F>   "INVALID DATASET NAME, A0SHFUFDF"
 INVALID DATASET NAME, A0SHFUFDF               
    126 *-* IF SYSDSN(FILE)='OK'               
        >V>   "A0SHFUFDF"                       
 INVALID DATA SET NAME, A0SHFUFDF               
        >F>   "INVALID DATASET NAME, A0SHFUFDF"
        >L>   "OK"                             
        >O>   "0"                               
 ***                                           


Where a0shfufdf is the invalid dataset


Thanks
Sai
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Fri Aug 10, 2007 4:49 pm    Post subject:
Reply with quote

Hi sai,
did u use the code for a valid dataset??
it is not working for me for a valid dataset
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Fri Aug 10, 2007 4:54 pm    Post subject:
Reply with quote

Hi,

I used the code for valid dataset also, It worked as expected

Code:
   123 *-* SAY 'ENTER A FILE NAME'
        >L>   "ENTER A FILE NAME" 
 ENTER A FILE NAME                 
    124 *-* PARSE UPPER PULL FILE 
a028113.sai.name                   
        >>>   "A028113.SAI.NAME"   
    125 *-* SAY SYSDSN(FILE)       
        >V>   "A028113.SAI.NAME"   
        >F>   "OK"                 
 OK                               
    126 *-* IF SYSDSN(FILE)='OK'   
        >V>   "A028113.SAI.NAME"   
        >F>   "OK"                 
        >L>   "OK"                 
        >O>   "1"                 
        *-*  THEN                 
    127 *-*  SAY 'FILE EXISTS'     
        >L>    "FILE EXISTS"       
 FILE EXISTS                       


Where A028113.SAI.NAME Is the valid Dataset

Thanks
Sai
Back to top
View user's profile Send private message
shchan

New User


Joined: 06 Jun 2007
Posts: 58
Location: Hyderabad

PostPosted: Fri Aug 10, 2007 5:17 pm    Post subject:
Reply with quote

ok..thanx Sai
Is there anyother way apart from this to know whether a pds or ps exists?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Fri Aug 10, 2007 5:20 pm    Post subject:
Reply with quote

There is also LISTDSI, but for your needs - SYSDSN is fine. Simply post your code with TRACE I.

O.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 10, 2007 7:28 pm    Post subject:
Reply with quote

Hello,

FWIW - when something does not work, it is not good practice to toss it and try some other approach (except in certain crisis situations).

This is an excellent opportunity to learn something that will not only get your current code to work, but you will have this in your "inventory" for later use.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Aug 10, 2007 7:46 pm    Post subject: Re: Usage of SYSDSN to find whether a ps or PDS exists
Reply with quote

Also, FWIW, I'm kinda thinking it's a problem with the O/P not properly qualifying the datasets. For instance, I noticed in the trace output that the dataset name entered showed as "VV8.REXX.EXEC", not as "'VV8.REXX.EXEC'", which is how I would expect it would show. I mean, if I enter a dataset name like "PROD.PROCLIB" I get "DATASET NOT FOUND", whereas if I enter a dataset like "'PROD.PROCLIB'" I get "OK".

I'd be curious as to what the O/P's TSO PROFILE setting is for the PREFIX.
Back to top
View user's profile Send private message
zos5415

New User


Joined: 29 Aug 2008
Posts: 18
Location: China

PostPosted: Wed Nov 06, 2013 12:56 pm    Post subject: Reply to: Usage of SYSDSN to find whether a ps or PDS exists
Reply with quote

this do have relationship with the profile setting, if you input file name but return invalid and the the file do exist . you need change your profile prefix to no and try again
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed Nov 06, 2013 3:48 pm    Post subject: Re: Reply to: Usage of SYSDSN to find whether a ps or PDS ex
Reply with quote

zos5415 wrote:
this do have relationship with the profile setting, if you input file name but return invalid and the the file do exist . you need change your profile prefix to no and try again

Yes OK for a work around, but nothing ever beats coding it correctly in the first place.

Also, This topic has been dormant for 6+ years icon_cry.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts How to find the first monday of the w... abdulrafi COBOL Programming 10 Fri Nov 25, 2016 3:24 pm
No new posts Find out a active PGM jpsager JCL & VSAM 10 Fri Oct 07, 2016 4:32 pm
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts how to find clist's or view library Andrew Hsia CLIST & REXX 4 Tue Jun 28, 2016 6:07 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us