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
 

 

REXX auto prefixing problem.

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
sdaruna

New User


Joined: 11 Jan 2010
Posts: 13
Location: india

PostPosted: Wed Aug 24, 2011 7:36 pm    Post subject: REXX auto prefixing problem.
Reply with quote

HI All,

When i was accepting a Dataset name as input in REXX, it was adding the Prefix automatically.

Ex - If i ve given input as aaa.bbb.ccc, its considering the input as xyz.aaa.bbb.ccc.

If that prefixing was due to the profile, i dont want to do changes to my profile and dont want to use any strip or substring commands.

Please help me out, to make the program to consider the PDS name without any prefix in REXX.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 24, 2011 7:43 pm    Post subject:
Reply with quote

here we go again,

you know what you are doing (as far as what you are doing)
be we have no idea.

1. what input method/process are you using?

2. are you putting single quotes around the DSN before you use it in any sytem command within your rexx script?

I imagine the answer to #2 is no, and that is why your arguement is being prefixed with the racf/sms project/group prefix of which you are a member.

I don't image that you are using TRACE? refer to the manual,
add the TRACE command to your script and run it again.
then come back with your questions.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Aug 24, 2011 7:43 pm    Post subject: Reply to: Please help me out.. REXX auto prefixing problem.
Reply with quote

You did not give an example of the commands that produce the error, but likely you need to add quotes in your commands:
Code:

"ALLOC F(A)  DSN(my.pds)"
"ALLOC F(B)  DSN('my.pds')"


In the first case without quotes, it will add the prefix defined in my profile.

In the second case, the 'fully qualified' name is specified through the use of quotes and your prefix will not be added.

It is not a problem: it is a feature.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Aug 24, 2011 7:53 pm    Post subject: Re: Reply to: Please help me out.. REXX auto prefixing probl
Reply with quote

Pedro wrote:
It is not a problem: it is a feature.

And it is a feature of TSO, not Rexx.
Back to top
View user's profile Send private message
sdaruna

New User


Joined: 11 Jan 2010
Posts: 13
Location: india

PostPosted: Wed Aug 24, 2011 7:55 pm    Post subject: Reply to: Please help me out.. REXX auto prefixing problem.
Reply with quote

I dont want to show it in complex way..
till now i have been using the strip command.

I tried simple one to show as an example.

SAY 'ENTER 2 DATASETS'
PULL S1
PULL S2
SELECT
IF SYSDSN("S1") <> 'OK' THEN SAY "DATASET DOESN'T EXIST" S1
END

after executing it
IF I VE GIVEN INPUT AS AAA.BBB.CCC, ITS ADDING MY PROJECT DIRECTORY AUTOMATICALLY TO THE ENTERED INPUT
Back to top
View user's profile Send private message
sdaruna

New User


Joined: 11 Jan 2010
Posts: 13
Location: india

PostPosted: Wed Aug 24, 2011 7:58 pm    Post subject: Reply to: Please help me out.. REXX auto prefixing problem.
Reply with quote

knew its a feature..
say..i didnt put it properly..

Now, i dont want to get those prefixes added to the input...
if there is any predefined function or any solution is there to do it in rexx it self, please help me out.

sorry, if i was not connecting you well.. i was in a bit of hurry...
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Aug 24, 2011 8:11 pm    Post subject:
Reply with quote

:: sigh :: You completely failed to read and/or understand what Mr. Brenholtz wrote, didn't you? He gave you the solution.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 24, 2011 8:13 pm    Post subject:
Reply with quote

sdaruna,

you are not helping yourself by not giving us any information.

plus, your coding is sloppy
Code:

IF SYSDSN("S1") <> 'OK' THEN SAY "DATASET DOESN'T EXIST" S1


try
Code:

IF SYSDSN('S1') <> 'OK' THEN SAY 'DATASET: ' S1 ' DOESN'T EXIST'


and you are lazy. had you used trace,
you would have seen that "S1" does not prevent prefixing.
'S1' will.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Wed Aug 24, 2011 8:32 pm    Post subject:
Reply with quote

Actually, just tried it - quoting (single or double) prevents prefixing
Code:
/*- Rexx -*/
Say 'Enter a dataset name:'
Pull dsn1
If SYSDSN("dsn1") <> 'OK' THEN SAY "Double quoted dsn does not exist"
If SYSDSN('dsn1') <> 'OK' THEN SAY 'Single quoted dsn does not exist'
If SYSDSN(dsn1) <> 'OK' THEN SAY 'Unquoted dsn does not exist'
Exit

Code:
 Enter a dataset name:
jcl.cntl
 Double quoted dsn does not exist
 Single quoted dsn does not exist
 ***
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Thu Aug 25, 2011 1:36 am    Post subject: Reply to: Please help me out.. REXX auto prefixing problem.
Reply with quote

Quote:
Actually, just tried it - quoting (single or double) prevents prefixing

Nic, show us your trace.

There are two things in play here:

1. the quotes are delimiters for string constants in rexx

2. The single quotes are used in TSO commands to determine if it is fully qualified or if the prefix should be added.

In Nic's example, I believe the quotes prevent variable substitution and it will always look for '&prefix.DSN1'

To prevent the prefix from being added, you need both the single quote for TSO and the double quote for rexx:

Code:
pull DSN1
dsn1 = "'" || dsn1 || "'"


Or the user can provide the quotes. Which your program needs to account for.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1712
Location: UK

PostPosted: Thu Aug 25, 2011 11:54 pm    Post subject:
Reply with quote

icon_redface.gif icon_redface.gif icon_redface.gif icon_redface.gif

Also, I think I mis-interpreted what DBZ was saying.

But, while I was pondering this and saying to myself that if you do not want a datset prefixed by your default prefix then single quote it, I recalled that you can single quote a dataset in jcl thus
Code:
//BLAH DD DSN='N13964.JCL.CNTL',DISP=SHR

Useless with standard MVS DSNs but you sometimes get datasets from other OSes that allow blanks, for example, in a dataset name. Not a lot of people left who know that (possibly).
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri Aug 26, 2011 12:40 am    Post subject:
Reply with quote

Nic Clouston wrote:
But, while I was pondering this and saying to myself that if you do not want a datset prefixed by your default prefix then single quote it, I recalled that you can single quote a dataset in jcl thus
Code:
//BLAH DD DSN='N13964.JCL.CNTL',DISP=SHR

Useless with standard MVS DSNs but you sometimes get datasets from other OSes that allow blanks, for example, in a dataset name. Not a lot of people left who know that (possibly).

An SMS-managed data set will only allow the standard character set (decimal digits, uppercase alphas, and nationals) and hyphens to be used in DSNs. If, OTOH, the data set is not SMS-managed, you can use any character in the DSN except X'04'.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Fri Aug 26, 2011 2:00 am    Post subject: Reply to: Please help me out.. REXX auto prefixing problem.
Reply with quote

BTW, I think the manual describes the issue of quotes / prefixes for SYSDSN fairly well:
Quote:
You can specify the dsname in any of the following ways:

* Fully-qualified data set name -- The extra quotation marks prevent
TSO/E from adding your prefix to the data set name.

x = SYSDSN("'sys1.proj.new'")

x = SYSDSN('''sys1.proj.new''')


* Non fully-qualified data set name that follows the naming conventions
-- When there is only one set of quotation marks or no quotation
marks, TSO/E adds your prefix to the data set name.

x = SYSDSN('myrexx.exec')

x = SYSDSN(myrexx.exec)


* Variable name that represents a fully-qualified or non fully-qualified
data set name -- The variable name must not be enclosed in quotation
marks because quotation marks prevent variable substitution.

variable = "exec"
x = SYSDSN(variable) /* looks for 'userid.exec' */
y = SYSDSN('variable') /* looks for 'userid.variable' */
z = SYSDSN("'"variable"'") /* looks for 'exec' */


Nic mentioned:
Quote:
I think I mis-interpreted what DBZ was saying.

You probably read it right, but his example was also wrong.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 26, 2011 2:04 pm    Post subject:
Reply with quote

Pedro,
you are correct.

I usually just put my DSNs in a variable,
when I want to avoid prefixing, I include the single quotes in the varaible
when I want to have the prefixing done, i don't include the single quotes in the variable.

agan,
this should be a no brainer, when you run with TRACE,
you see the resolved DSN for the ALLOC or SYSDSN command
and fiddle with it til it works.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 26, 2011 2:20 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
[...]this should be a no brainer, when you run with TRACE,
you see the resolved DSN for the ALLOC or SYSDSN command
and fiddle with it til it works.


This is where I exhibit inconsistency, with regards to the "debugger" sort of thing.

The above is always how I do it (the trace and fiddle part) in rexx. It's how I learned rexx and the intricacies of CMS, XEDIT etc.
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Aug 30, 2011 12:19 am    Post subject: Re: Reply to: Please help me out.. REXX auto prefixing probl
Reply with quote

sdaruna wrote:

IF SYSDSN("S1") <> 'OK' THEN SAY "DATASET DOESN'T EXIST" S1


The SYSDSN() is not a rexx function but actually a TSO External function. It is TSO that prefixes the dataset name with your user id. Rexx will pass a string to SYSDSN. If that string is enclosed in single quotes then TSO doesn't prefix it. This is the same as using option 1 or 2 in ISPF.

In your Rexx you need to add the single quote to the string. Below is sample code
Code:
ARG dsname                         
                                   
msg = SYSDSN("'" || dsname || "'")
IF msg <> 'OK' THEN               
  SAY dsname msg                   
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Aug 30, 2011 9:11 pm    Post subject: Reply to: REXX auto prefixing problem.
Reply with quote

Code:
IF SYSDSN("S1") <> 'OK' THEN SAY "DATASET DOESN'T EXIST" S1


BTW, there could be problems other than 'does not exist'.

Perhaps something like this is more useful to display the actual message that is returned:
Code:
IF SYSDSN("S1") <> 'OK' THEN
    SAY "Problem with" S1 ":" sysdsn("s1") 
Back to top
View user's profile Send private message
jerryte

Active User


Joined: 29 Oct 2010
Posts: 183
Location: Toronto, ON, Canada

PostPosted: Tue Aug 30, 2011 10:20 pm    Post subject:
Reply with quote

Pedro

Take a look at the code I posted above yours. It does something similiar but is more efficient since it calls SYSDSN only once. The message is assigned to a variable "msg" so that it can be written out as part of an error message.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Tue Aug 30, 2011 10:33 pm    Post subject: Reply to: REXX auto prefixing problem.
Reply with quote

time to lock the topic, too much useless noise on the air icon_cool.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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 What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am


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