[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: XPL question



Reply to note from "Patricia M. Godfrey"  Wed,
09 May 2007 18:01:55 -0400

Patricia:

> I have two routines that use similar procedures to create a
> directory if it doesn't exist, CD to it, create a file if it
> doesn't exist (or regardless), and open it. Both work, but the
> first (council) generates an "Access denied" error message
> after the MKDIR command, even when the dir doesn't need to be
> created, because it already exists.

This may not answer the question, but you do need to add the "e:"
drive spec to your EXIST commands: BX exist e:Q2 ; otherwise,
you may get unexpected results if the current drive is not E: and
the directory in question exists (or doesn't exist) on the current
drive, but does not exist (or does) on the E: drive.

Another flaw in the EXIST statement as written -- which may or may
not be a factor in the way you use the routine -- is that it tests
indiscriminately for the presence of a directory OR a file; if a
file named  is present, then the ensuing MKDIR command will,
of course, fail even though no such directory exists. To test
unambiguously for a directory, you need, initially,
BX exist e:\*.*Q2 (both the trailing backslash and star-dot-
star are required), then an additional test without the "\*.*",
BX exist e:Q2, to eliminate the possibility that a file so
named exists; only if there no such directory or file can you
confidently issue the MKDIR command. The code would look like this:

>BX exist e:\*.*Q2 ;*;
>BX exist e:Q2 ;*;
)>;*;
BX mkdir e:Q2 ...

Or in real (DECODEable) XPL:

XPLeNCODE v2.0
b-gin [UNTITLED]
{<}SX01,{<}VA$DAyyyy{>}{>}[BX_]exist e:{<}PV01{>}\*.*[Q2_]{<}
IF{<}ER{>}{>}[BX_]exist e:{<}PV01{>}[Q2_]{<}IF@NOT({<}ER{>}){
{062}}{<}PRError: Existent filename @01{>}{<}EX{>}{<}EI{>}[BX_]mk
dir e:{<}PV01{>}[Q2_]{<}EI{>}...[cr|lf][cr|lf]
-nd
XPLeNCODE

These points aside, I don't see any other mistake in your code that
should trigger the "Access denied" error.

--
Carl Distefano
cld@xxxxxxxx