RPL help. . .



#3

Hi, All!

I have a repeatable file result that stored in "xxx"
variable.

Does anyone could help to check if this file is
exist and if so the result file name will be changed
and will be stored as "xxx1" and so on.

Best regards,
Tal


#4

To check whether the variable exists, use RCL within an IFERR structure,
like this:

\<<
'XXX'
IFERR
RCL
THEN
(whatever action to take if the variable doesn't exist goes here)
ELSE
DROP (whatever action to take if the variable does exist goes here)
END
\>>
You may want to refine the THEN clause by nesting a conditional (IF...
or CASE...) structure in there with ERRN to check that the error was
really #204h, "Undefined Name".

But note that this checks whether the variable exists anywhere on the
current path. To restrict the search to the current directory, maybe:

\<<
VARS 'XXX'
IF
POS
THEN
(whatever action to take if the variable does exist goes here)
ELSE
(whatever action to take if the variable doesn't exist goes here)
END
\>>
But note that VARS is slow when the current directory is large.

What you want to do resembles what happens when the calculator receives
a file with the same name as an existing variable in the same directory
and flag -36 is clear, so there may well be a SysRPL entry that would
help you.

Regards,

James


Possibly Related Threads…
Thread Author Replies Views Last Post
  Writing RPL programs on OS X Sean Freeman 18 5,373 11-30-2013, 03:59 PM
Last Post: Sean Freeman
  48G vs 49G+ User RPL Speed Comparison John Colvin 7 2,718 11-16-2013, 10:07 PM
Last Post: Han
  RPL 32 David Hayden 4 2,133 11-11-2013, 11:34 AM
Last Post: David Hayden
  HHC / HP Museum Programming Contest for RPN and RPL machines Gene Wright 18 5,793 09-22-2013, 09:39 AM
Last Post: Miguel Toro
  RPL long vs. short names peacecalc 5 2,116 10-30-2012, 01:25 PM
Last Post: peacecalc
  Mini-challenge: HHC2012 RPL programming contest with larger input David Hayden 14 3,725 10-05-2012, 10:36 PM
Last Post: David Hayden
  HHC 2012 RPL Programming Contest Gene Wright 33 8,030 09-27-2012, 01:57 AM
Last Post: Werner
  HHC 2012 programming contests coming soon (RPN and RPL) Gene Wright 9 2,779 09-21-2012, 03:38 PM
Last Post: Paul Dale
  RPL prog for Fibonacci on HP 48G needs minor modification. help. wildpig 68 17,224 07-09-2012, 09:38 AM
Last Post: Gilles Carpentier
  RPL/2 under HP-UX Martin Paech 2 1,141 04-21-2012, 07:36 AM
Last Post: David Hayden

Forum Jump: