Page 1 of 1

how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 4:01 pm
by SKANDA
Hi All,

please guide me to use appropriate quotes in below syntax,

dataset_name = " ' " xyz.abc.opl " ' "
file = dataset_name
x = outtrap(dc.)
"listds (" ' file ' " )members"
x = outtrap(off)

I have tried to get the members of the dataset by using the above code,but due to improper qutotaions I dint get the output.
kindly help me out.

Thanks,
Skanda

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 4:52 pm
by NicC
When you:
SAY dataset_name and file
what do you get
What do you get when you put a trace on?
Why move 'dataset_name' to 'file'?

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 6:58 pm
by SKANDA
hi,

(I) When I used the datasaet_name and file with the quotations mentioned, members of the dataset is not listed in the stem variable.
so I couldn't process further.(I guess that there might be mistake in the quotation that's why the member of the mentioned dataset is not listed)
(ii)For display purpose I have moved dataset name to file.

Thanks,
Skanda

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 10:45 pm
by Pedro
You did not really answer any of Nicc's questions. I do not believe he was asking for descriptive answers, but to show us exactly what you see in the trace.

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 10:51 pm
by Pedro
There are probably other errors, but this comes to mind:
"listds (" ' file ' " )members"

You should know that both the double-quote and the single quote are delimiters for constants. In this line, you have three constants, the same as this:
"constant1"   'constant2'  "constant3"

It will not try to resolve the variables like you expect because no variables are shown here; they are all quoted strings.

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 10:56 pm
by NicC
Exactly, Pedro.
Skanda, both dataset_name and file will have their contents displayed nicely using SAY as one is a simple copy of the other. All data in Rexx is text. If that text is numeric then rexx can do maths with it.

You can probably do this:
dataset_name = " ' " xyz.abc.opl " ' "
Say dataset_name
x = outtrap(dc.)
"listds ("dataset_name" )members"
x = outtrap(off)

You can also add thge following line before the assignment to dataset_name
trace ?r

and the following after the Say
trace o

Re: how to use qutotaions in listds commands?

PostPosted: Wed Jan 18, 2017 11:47 pm
by Pedro
When you edit rexx programs using the ISPF editor, issue the 'HI ON' command. Context sensitive highlighting will be turned on. It will be readily apparent when you type a constant vs. when you time a variable.

Re: how to use qutotaions in listds commands?

PostPosted: Thu Jan 19, 2017 10:19 pm
by willy jensen
assuming that the datasetname is xyz.abc.opl then this is how to do it:
]
dataset_name = "'xyz.abc.opl'"
file = dataset_name
x = outtrap(dc.)
"listds" file "members"
x = outtrap(off)
 

Note that you cannot have blanks between the apostrophes, so if xyz.abc.opl is a stem variable containing the datasetname then the first assignment must be like this:
dataset_name = "'"xyz.abc.opl"'"

Re: how to use qutotaions in listds commands?

PostPosted: Mon Jan 23, 2017 12:31 pm
by SKANDA
Hi all,

Thank you all for your great response.
I got the thing which I want.
Thank you NicC by using "Trace" option only I can find the mistake where I went wrong..

Many Thanks,
Skanda

Re: how to use qutotaions in listds commands?

PostPosted: Mon Jan 23, 2017 2:54 pm
by NicC
You should always, ALWAYS, ALWAYS use Trace before you post a query.