Setting VMS logicals from Quick

Thomson, Martyn EDUC:EX martyn.thomson@gems1.gov.bc.ca
Fri, 12 Feb 1999 14:42:50 -0800


Thanks Rich,
That was the problem - too many quotes.  
I guess the programmer started out using a double-quoted " string, so would
have had to double up to get the embedded double-quotes for the lexical and
the null string, then must have switched to single quotes ' but left the
double quotes in place. 
Since it worked in 1998 because the file was there, and there was no
compilation error, I overlooked the syntax errors!
Thanks again,
Martyn
> ----------
> From: 	Rich `Lego-Man' Jesse - 7633[SMTP:RJESSE@QTIWORLD.COM]
> Sent: 	February 12, 1999 2:05 PM
> To: 	powerh-l@lists.swau.edu
> Cc: 	Thomson, Martyn EDUC:EX
> Subject: 	Re: Setting VMS logicals from Quick
> 
> Martyn Thomson posted:
> 
> MT> Does anyone have experience of repeatedly setting a VMS logical using
> the
> MT> RUN COMMAND verb?
> MT> Here's the scenario - 
> ...
> MT>   LET T_COMMAND = &
> MT>    "DEFINE/JOB TAB$SUBJ$AREA TSQ$DISK8:[DATA_1999]TAB_SUBJ_AREA.DAT"
> MT>   RUN COMMAND T_COMMAND
> MT> 
> MT> Then test if the file exists, if not use the previous year's data  - 
> MT> 
> MT>   LET T_COMMAND = '$ IF F$SEARCH(""TAB$SUBJ$AREA"") .EQS. """" THEN '
> + &
> MT>    "DEFINE/JOB TAB$SUBJ$AREA TSQ$DISK8:[DATA_1998"]TAB_SUBJ_AREA.DAT"
> MT>   RUN COMMAND T_COMMAND
> MT> 
> MT> If the file exists in 1999 there's no problem, it works fine and the
> file is
> MT> accessed, but if it's in 1998 the logical isn't replaced!
> 
> I assume that the extraneous quote (") next to DATA_1998 in your second
> DEFINE/JOB is a typo, right?
> 
> Having been a VMSer for 12 years now, I'm not sure why you have the quotes
> doubled up in the F$SEARCH lexical function.  The only reason to duplicate
> a
> quote is when you want a quote in a literal.  For example:
> 
>         $MY_SYMBOL = "Rich "Lego-man" Jesse"
> 
> ... is improper syntax.
> 
>         $MY_SYMBOL = "Rich ""Lego-man"" Jesse"
> 	$SHOW SYMBOL MY_SYMBOL
> 	  MY_SYMBOL = "Rich "Lego-man" Jesse"
> 
> ... is the correct way of specifying a quote character within a quoted
> literal.
> 
> Now, your doubled-up quotes in F$SEARCH(""TAB$SUBJ$AREA"") will still work
> (although I can't give you the exact reason why).  But the lexical will
> never
> return a quote, which is what """" is equal to.  Remember, DCL will
> interpret
> """" as a literal specifying one quote character.  So, the IF will
> *always* be
> false, and the second DEFINE/JOB can *never* be executed.
> 
> One last thing I'm not sure about is if QUICK requires the extra quotes
> for the
> RUN COMMAND command, but I'm fairly certain it doesn't.  For a fix, try:
> 
>         LET T_COMMAND = '$ IF F$SEARCH("TAB$SUBJ$AREA") .EQS. "" THEN ' +
> &
>         "DEFINE/JOB TAB$SUBJ$AREA TSQ$DISK8:[DATA_1998]TAB_SUBJ_AREA.DAT"
>         RUN COMMAND T_COMMAND
> 
> Hope this helps!  Let me know how/if it works!  :)
> 
> Rich Jesse                              Programmer/Analyst
> rjesse@qtiworld.com                     Quad/Tech International, Sussex,
> WI USA
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> =
> Subscribe: "subscribe powerh-l" in message body to
> majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
> This list is closed, thus to post to the list, you must be a subscriber.
> 
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.