IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Usage of SYSDSN to find whether a ps or PDS exists


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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
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
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
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
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
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
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: 2358
Location: Israel

PostPosted: Fri Aug 10, 2007 5:20 pm
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

Moderator Emeritus


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

PostPosted: Fri Aug 10, 2007 7:28 pm
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

Global Moderator


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

PostPosted: Fri Aug 10, 2007 7:46 pm
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
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: 8797
Location: Welsh Wales

PostPosted: Wed Nov 06, 2013 3:48 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts STEM usage in REXX CLIST & REXX 14
No new posts Find the occurrence of Key Field (Par... DFSORT/ICETOOL 6
No new posts Find a record count/numeric is multip... COBOL Programming 1
Search our Forums:

Back to Top