1827708 Members
2883 Online
109967 Solutions
New Discussion

Re: DCL language

 
SOLVED
Go to solution
simon_164
Super Advisor

DCL language

What's the difference between single quotation and double quotation?
is 'p' is a symbol substitution or is it ''p' ?
what's the difference between: "''p'" and ""''p'"" ?
if we take it more further, how to know the output?
"""''p'""" ; """"''p'"""" ; """""''p'""""" ?
double quotation is easy, but when mixed with single quotation gives very odd output?
I'm asking this because i got it as a question in the VMS administrator exam !!
Thanks and regards.
19 REPLIES 19
Jan van den Ende
Honored Contributor

Re: DCL language

Simon,

first, your question is very hard to read in the ITRC display, as you will note yourself when you see it back.
I will try to guess, but probably you get the concept.
Okay. I copied it into the input screen, now it is clear.

"''p'" upon execution is replaced with a quoted string with the value of P

""''p'"" is a double quote charecter, followed by the letter P followed by a double quote, ie, the string "P"


-- if you have access to a VMS system, you can very easily try it yourself!

P="abcde"
xx = "''p'"
show symbol xx
xx = ""''p'""
show symbol xx


hth

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
simon_164
Super Advisor

Re: DCL language

Sorry about the misunderstanding.I'll resubmit the thread differently.
What's the difference between single quotation and double quotation?
is `p` symbol substitution or is it ``p` ?
what's the difference between: "``p`" and ""``p`"" ?
if we take it more further, how to know the output?
"""``p`""" ; """"``p`"""" ; """""``p`""""" ?
double quotation is easy, but when mixed with single quotation gives very odd output?
I'm asking this because i got it as a question in the VMS administrator exam !!
I've tried it on my system, but I am not being able to get a conclusion about these. how to guess what's the output.
Thanks and regards.

Dale A. Marcy
Trusted Contributor

Re: DCL language

It gets confusing with the single and double quotes together. In this reply, I will add spaces between characters that do not normally appear.

A normal ' means symbol substitution, but the problem arises when you want a symbol substitution inside a quoted ( " ) string. In that case you use two single quotes inside the quoted string (i.e. " ' ' P ' ").

If you need to include a double quote inside a string, then you place two of them consecutively (i.e., " Add a Quote " " to this string", would assign Add a Quote " to this string).

Remember that I added extra spaces around each " and ' in the above to hopefully add clarity. The spaces would not be there in the real usage.
Daniel Fernandez Illan
Trusted Contributor

Re: DCL language

Simon,

Double quotation indicates literal.
If you includes only one single quotation between doubles ("`p`"), DCL implement the first single quotation as a ASCII character.

If you include a new single quotation before the first ("``p`"), you indicate to DCL that the second single quotation is a "DCL character" and substitutes ``p` with p symbol value.
Regards.
Jan van den Ende
Honored Contributor

Re: DCL language

Well,

after giving it some more thought, I think I had better try to play "parser", while explaining.

I am assuming the examples ARE the context, and that this is NOT WITHIN a string (if so, see the exercise at the end)

" ' ' p ' "

(extra spacing for readability only!)

The first double quote is the start of a string.
Within a string, if symbol substitution is to be done, that symbol MUST be directly preceeded by two single quotes, and followed by another one.
The next double quote terminates the string.
So, summed up, this represents a string wth the value of P as value.

" " ' ' P ' "

The first double quote is again the start of a string.
Then the second, if not IMMEDIATELY followed by a third, means end-of-tring.
So, together, an empty ( = zero-length) string.
The first single quote is the start of a symbol substitution. The next is the end, so an empty symbol vaule ( = nothing) is inserted.
Then the literal P
Next, another substitution starts.
Asymbol name ends with any non-valid character for symbol-name syntax, for which the double quote qualifies. Another nothing.
Two double quotes: see above.

"we take it further":
Two double quotes concatenated within a string represent the double quote character.
So 3 double quotes is the beginning of a string, that starts with a double quote.
Four double quotes: the end also, that means, the single character string of one double quote character.

The rest is just stubbornly applying the above, as much as necessary.

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
John Gillings
Honored Contributor
Solution

Re: DCL language

See section 12.12 "Understanding Symbol Substitution" in the OpenVMS User's Manual

http://h71000.www7.hp.com/doc/731FINAL/6489/6489pro_033.html#symbol_substitution

Try out the examples...
A crucible of informative mistakes
Terry Yeomans
Frequent Advisor

Re: DCL language

I've found that the following usually works for me:

p = "fred"

p gives fred

" ' ' p ' " gives fred

" " ' ' p ' " " gives " fred "

Hope this helps.
Terry.
Antoniov.
Honored Contributor

Re: DCL language

Simon,
multiple symbols (single quote and double quote) are used in mixed mode.
Inside two double quote, usually you put some string; e.g. S="My string"
Inside two single quote you put any symbol to substitute; e.g. 'P'
If you need of symbol substitution inside a string you must use twice single quote; e.g.
$ P="My string"
$ S="''P'" !Double quote, twice single quote, uppercase P, single quote, double quote
If you need some double quote inside a string, because double quote means string separator, you need twice double quote; e.g.
$ S="My ""quote"""
$ sh ym S

Please, look at first twice double quote, used to insert double quote symbol inside string and triple double quote at end that is a twice double quote plus double quote to end string.

H.T.H.
Antonio Vigliotti
Antonio Maria Vigliotti
Antoniov.
Honored Contributor

Re: DCL language

Hi Simon,
I've forgotten ...
$ S="""" !4 times double quote
$ show sym S
<">
you have to read:
1.st double quote: open string
2.nd twice double quote: insert double quote into string
Last double quote: close string

Antonio Vigliotti
Antonio Maria Vigliotti
Cheryl Griffin
Honored Contributor

Re: DCL language

You can reward the many people who have assisted you by assigning points to their posts.

For steps how to assign points see:
http://forums1.itrc.hp.com/service/forums/helptips.do?#33
"Downtime is a Crime."
simon_164
Super Advisor

Re: DCL language

Excuse me but i am new to these forums, i'll try to find the best match to my question and i'll assign points.
Regards,
Jan van den Ende
Honored Contributor

Re: DCL language

Oooops!!!!

"i am new to these forums"

Yeah, as first one to answer I should have noted, but none of the others made up for my mistake.

So, belatedly, but all the more cordially:

"WELCOME to VMS & the VMS Forum, Simon!!!"

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: DCL language

Simon,

on giving points:
try to give points to EVERY answer to your questions!

It is fully up to you HOW MANY, and you can just give 0 (zero) if you think you don't want to give more.
Any assignment, including zero, removes the "unassigned" header.

It is reflected in your Forum Profile.
If you do not know that yet, then click your own name (in the questions summary, in your question header, in the header of any of your replies).

In your profile you will notice how many answers you have assigned to, from how many total.

If you somehow want more info on any other Forum user, it is basically the same.


( and hey, we have all begun as newbies, most of us stumbled over this! )

Proost.

Have one on me.

Jan
Don't rust yours pelled jacker to fine doll missed aches.
Andy Bustamante
Honored Contributor

Re: DCL language

There are very few third party books in the VMS world, that's a reflection on the documentation included. That being said, "Writing Real Programs in DCL" by Paul Anagnostopoulos and Steve Hoffman stays within arm's reach of my desk. There's an chapter on symbol substitution in DCL.
If you don't have time to do it right, when will you have time to do it over? Reach me at first_name + "." + last_name at sysmanager net
Mobeen_1
Esteemed Contributor

Re: DCL language

Gentlemen,
I have a doubt now going through this post, appreciate if you could clarify this, this is again about symbols and symbol substitutions

Look at the following

$STD = "01"+"-"+"DEC"+"-"+"2004"+":00:00:00.00"
$ETD = "31"+"-"+"DEC"+"-"+"2004"+":23:59:00.00"
$sh sym STD
STD = "01-DEC-2004:00:00:00.00"
$sh sym ETD
ETD = "31-DEC-2004:23:59:00.00"

If i would like to pass the values in the above symbol STD and ETD into some command, then how do i do it ? Should i say "''STD'" and "''ETD'" or ???

To make things simple lets assume that i would like to pass the values mentioned above within a DCL to the following command

$advise performance
select/x_points=480 -
/begin=
thanks
mobeen
Ian Miller.
Honored Contributor

Re: DCL language

I would expect this this to work (as there are no spaces etc in the values)
$advise performance select/x_points=480 -
/begin='STD'/end='ETD'
____________________
Purely Personal Opinion
Mobeen_1
Esteemed Contributor

Re: DCL language

Ian,
Thanks for your response. I see the following error

$ STD = "01"+"-"+"DEC"+"-"+"2004"+":00:00:00.00"
$ ETD = "31"+"-"+"DEC"+"-"+"2004"+":23:59:00.00"
$ advise performance
select/x_points=480-
/begin='STD'/end='ETD'
%CLI-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format

rgds
Mobeen

Simon :- i am sorry to be giving you more work, as this was the same topic, i posed my question. Please assign points at your convenience :)
Ian Miller.
Honored Contributor

Re: DCL language

Mobeen, your command does not work as the select command is processed by PSPA not DCL so the DCL symbol substituion is not performed.

To use the DCL symbols to create a graph look at the
ADVISE PERFORM GRAPH command

(so DCL can subtitute the symbols then pass the command to PSPA).
____________________
Purely Personal Opinion
Jan van den Ende
Honored Contributor

Re: DCL language

Mobeen,


$ advise performance
select/x_points=480-
/begin='STD'/end='ETD'
%CLI-W-IVATIME, invalid absolute time - use DD-MMM-YYYY:HH:MM:SS.CC format


Maybe the ITRC formatting messed things up, but, if I read this correctly,
you enter ONE line with just
$ advise performance
and then ON THE NEXT LINE you entered the image input command statements.

Well, symbol substitution is ONLY done on the command line, NOT in data lines!

It is been a long time, but if I remember correctly ADVISE also accepts its sub-commands on the commandline.
If so, simply add a "-" (continuation) after "performance", but if not, you will have to generate a temporary file in which you substitute the symbol-value during creation, and the execute it and delete it,
or, if you are on VMS 7.2 + ,
you can you a pipe construct.

Examples of that have come along regularly in this forum lately.

Hope this helps.


Simon :- i am sorry to be giving you more work, as this was the same topic, i posed my question. Please assign points at your convenience :)

Maybe next time, it would be better to open a new thread, and start it with pointing to the one you like to reference.

Proost.

Have one on me.

Jan


Don't rust yours pelled jacker to fine doll missed aches.