View previous topic :: View next topic
|
Author |
Message |
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
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 |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Hi shchan,
The Code is working fine for me , Can you post the Trace output .
Thanks
Sai |
|
Back to top |
|
|
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
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 |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
Hi sai,
did u use the code for a valid dataset??
it is not working for me for a valid dataset |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
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 |
|
|
shchan
New User
Joined: 06 Jun 2007 Posts: 58 Location: Hyderabad
|
|
|
|
ok..thanx Sai
Is there anyother way apart from this to know whether a pds or ps exists? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
There is also LISTDSI, but for your needs - SYSDSN is fine. Simply post your code with TRACE I.
O. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
zos5415
New User
Joined: 29 Aug 2008 Posts: 18 Location: China
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
|