A safer way to clear the passed RUN variables is: CLEAR VAR __-_ or CLEAR VAR
??-? depending on what your wildcard is set to.--Larry
On Monday, May 9, 2016 9:09 AM, Alastair Burr <[email protected]> wrote:
Razzak, thank you, I have read the From the Edge article.
I understand the renaming at various levels although I am only using the
first level.
What has caught me out is the clearing of the % variables as shown in the
RUN command help. Please let me try to explain:
I'll paste the relevant part to save anybody else looking it up:
The CLEAR VAR command below will clear all existing % variables (assuming
your SINGLE character setting is an underscore). The CLEAR VAR uses 2
underscores, a dash, and an underscore. The passed parameter variables will
display in TRACE mode as %1-1 in a single nesting level. If a called command
file calls another, the variable would then be %1-2. The x in "%1-x" is the
variable nesting level.
RUN cmdfile.rmd USING 'Display This Message' 10
--cmdfile.rmd
SET VARIABLE vstart TIME = .#TIME
SET VARIABLE vwait INTEGER = 0
SET VARIABLE vmessage TEXT = .%1
SET VARIABLE vmax INTEGER = .%2
CLEAR VAR __-_
SET VARIABLE
WHILE vwait < .vmax THEN
SHOW VARIABLE .vmessage
SET VARIABLE vwait = (.#TIME - .vstart)
ENDWHILE
CLS
CLEAR VARIABLES vstart, vwait, %1, %2
RETURN
The first CLEAR VAR command is clearly explained as clearing all specific
levels of % variables.
To me, the second CLEAR VAR command clears two defined variables (vstart &
vwait) and the two % variables passed from the RUN command - there are two
of them, hence %1 & %2.
I was having a problem when I passed 5 variables on one run and then only 4
of a subsequent run - the fifth one still seemed to be available when I
didn't want it used.
I thought/assumed that this second CLEAR VAR command which was missing from
my RMD file was the problem - so I added it with the five variables.
I also thought/assumed that % variables were "special" and it never crossed
my mind that the % was also a wildcard. I rarely use R:Base wildcards but I
do (still) in DOS use the * and ? which is more confusion.
So my question now is why does this second CLEAR VAR command have the two %
variables in it?
If I am reading it correctly the article seems to imply they are not needed
as they have already been cleared by the first CLEAR VAR command and without
clearing any other variables ending in whatever specific number.
Just one other point in passing: the USING parmlist help says that 18 values
can be passed and then says ...and so on through %9 - is there a
contradiction there or am I missing something else?
Thanks & regards,
Alastair.
-----Original Message-----
From: Alastair Burr
Sent: Sunday, May 8, 2016 8:55 PM
To: [email protected]
Subject: Re: [RBASE-L] - Can anybody explain this:
Thanks Razzak, I'll read properly tomorrow.
Regards,
Alastair.
-----Original Message-----
From: A. Razzak Memon
Sent: Sunday, May 8, 2016 6:46 PM
To: [email protected] ; [email protected]
Subject: Re: [RBASE-L] - Can anybody explain this:
Alastair,
In reference to Percent Variables, the following article might help
you understand better ...
>From The Edge: Understanding Percent Variables in R:BASE (Date
Posted: June 9, 2006).
http://www.razak.com/fte/
Although the article written in 2006 refers to R:BASE versions 7.5,
7.6, and Turbo V-8,
the principles apply to all versions of R:BASE, including 9.5 and
R:BASE X (Version 10).
Very Best R:egards,
Razzak
At 01:22 PM 5/8/2016, Alastair Burr wrote:
>Thank you Razzak & Karen - that explains many things - I'm afraid the pun
>has to be intended there.
>
>However, I'm doing the "CLEAR VAR %1, %2, %3, %4, %5" command as indicated
>in the help for the RUN
>command USING parmlist so other that not having any other variables ending
>in those digits how do I
>clear the RUN variables?
>
>I have to admit to blindly following the example without thinking but the
>variables have the % in
>the name.
>
>Thanks & regards,
>Alastair
>
>
>-----Original Message----- From: A. Razzak Memon
>Sent: Sunday, May 8, 2016 5:44 PM
>To: [email protected]
>Subject: Re: [RBASE-L] - Can anybody explain this:
>
>As the variable "vCycle1" ends with "1", using a command like CLEAR
>VAR %1 will
>clear every variable that ends with "1", based on your setting for MANY
>"%".
>
>This should be consistent with all versions of R:BASE!
>
>Hope that explains.
>
>Very Best R:egards,
>
>Razzak
>
>
>At 12:21 PM 5/8/2016, Alastair Burr wrote:
>
>>No database connected.
>>
>>R>clear all var
>>
>>R>show var
>>Variable = Value Type
>>------------------ ------------------------------ -------
>>#DATE = 08/05/2016 DATE
>>#TIME = 17:15:25 TIME
>>#PI = 3.14159265358979 DOUBLE
>>SQLCODE = 0 INTEGER
>>SQLSTATE = 00000 TEXT
>>#NOW = 08/05/2016 17:15:25 DATETIME
>>
>>R>set var vCycle1 INTEGER = NULL
>>
>>R>show var
>>Variable = Value Type
>>------------------ ------------------------------ -------
>>#DATE = 08/05/2016 DATE
>>#TIME = 17:15:49 TIME
>>#PI = 3.14159265358979 DOUBLE
>>SQLCODE = 0 INTEGER
>>SQLSTATE = 00000 TEXT
>>#NOW = 08/05/2016 17:15:49 DATETIME
>>vCycle1 = -0- INTEGER
>>
>>R>CLEAR VAR %1, %2, %3, %4, %5
>>
>>R>show var
>>Variable = Value Type
>>------------------ ------------------------------ -------
>>#DATE = 08/05/2016 DATE
>>#TIME = 17:16:09 TIME
>>#PI = 3.14159265358979 DOUBLE
>>SQLCODE = 0 INTEGER
>>SQLSTATE = 00000 TEXT
>>#NOW = 08/05/2016 17:16:09 DATETIME
>>
>>vCycle is cleared by clearing the % variables.
>>
>>Thanks & regards,
>>Alastair.
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to [email protected].
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"RBASE-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.