Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* f$search
@ 1998-09-01  4:00 David Gray
  1998-09-01  4:00 ` f$search Bill Henley
  1998-09-03  4:00 ` f$search John Cushnie
  0 siblings, 2 replies; 3+ messages in thread
From: David Gray @ 1998-09-01  4:00 UTC (permalink / raw)


i,

I would like to be able to go through all files on a disk, that have an
eight
byte numeric extension and delete them.  Iam trying to do this in a loop
using
f$search to find the file, then f$type to check if the extension is an
integer.

My problem is that if I find an extension that is not numeric it needs
ignoring
and the next file checking using f$serach, however f$search will always
retrun
the next file in sequence, ie the one I have just checked.

This example will probably explain what Iam trying to do better.


$ FILE_TO_DELETE = UDISK1:<USERS...>*.%%%%%%%%;*
$
$START:
$
$ SEARCH_FILE = F$SEARCH(FILE_TO_DELETE)
$ FILE_EXT    = F$ELEMENT(0,";",F$ELEMENT(1,".",SEARCH_FILE))
$ EXT_TYPE    = F$TYPE(FILE_EXT)
$
$ IF EXT_TYPE .EQ. "INTEGER"
$ THEN
$   DELETE 'SEARCH_FILE;*
$ ENDIF
$
$ GOTO START
$


No problems when file.12345674 is found this is deleted, but also
returned
is file.template which is not deleted so stays on top of the pile, the
next
search finds it again.


Does anyone have a solution to this problem.


Regards,

    David





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: f$search
  1998-09-01  4:00 f$search David Gray
@ 1998-09-01  4:00 ` Bill Henley
  1998-09-03  4:00 ` f$search John Cushnie
  1 sibling, 0 replies; 3+ messages in thread
From: Bill Henley @ 1998-09-01  4:00 UTC (permalink / raw)


David Gray wrote:
> 
> i,
> 
> I would like to be able to go through all files on a disk, that have an eight
> byte numeric extension and delete them.  Iam trying to do this in a loop using
> f$search to find the file, then f$type to check if the extension is an integer.
> 
> My problem is that if I find an extension that is not numeric it needs ignoring
> and the next file checking using f$serach, however f$search will always retrun
> the next file in sequence, ie the one I have just checked.
> 
> This example will probably explain what Iam trying to do better.
> 
> $ FILE_TO_DELETE = UDISK1:<USERS...>*.%%%%%%%%;*
> $
> $START:
> $
> $ SEARCH_FILE = F$SEARCH(FILE_TO_DELETE)
> $ FILE_EXT    = F$ELEMENT(0,";",F$ELEMENT(1,".",SEARCH_FILE))
> $ EXT_TYPE    = F$TYPE(FILE_EXT)
> $
> $ IF EXT_TYPE .EQ. "INTEGER"
> $ THEN
> $   DELETE 'SEARCH_FILE;*
> $ ENDIF
> $
> $ GOTO START
> $
> 
> No problems when file.12345674 is found this is deleted, but also returned
> is file.template which is not deleted so stays on top of the pile, the next
> search finds it again.
> 
> Does anyone have a solution to this problem.
> 
> Regards,
> 
>     David


Change the last lines to:

$   DELETE 'SEARCH_FILE
$ ENDIF
$
$ if search_file .nes. "" then GOTO START

Without a way out of the loop when you are done searching the first
time, you will start another search after deleting all the .123456's. 
You don't want a "next search" - just "next iteration of first search".

The ;* at the end of the DELETE 'SEARCH_FILE yeilds an error.

Bill Henley



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: f$search
  1998-09-01  4:00 f$search David Gray
  1998-09-01  4:00 ` f$search Bill Henley
@ 1998-09-03  4:00 ` John Cushnie
  1 sibling, 0 replies; 3+ messages in thread
From: John Cushnie @ 1998-09-03  4:00 UTC (permalink / raw)


Hi,

You have to an indexed f$search, eg

  $ SEARCH_FILE = F$SEARCH(FILE_TO_DELETE, I_COUNT)

                                       Where I_COUNT is set to some integer.

This is required where you want to keep the context of the search you are
doing....

You can have multiple contexts (or indexed searches), but the whole thing
gets pretty horrible....

Checkout the help on $ help lex f$search, or the examples in the DCL books.


Hope this helps.
John Cushnie
email: cushnie@csi.com

David Gray wrote:

> i,
>
> I would like to be able to go through all files on a disk, that have an
> eight
> byte numeric extension and delete them.  Iam trying to do this in a loop
> using
> f$search to find the file, then f$type to check if the extension is an
> integer.
>
> My problem is that if I find an extension that is not numeric it needs
> ignoring
> and the next file checking using f$serach, however f$search will always
> retrun
> the next file in sequence, ie the one I have just checked.
>
> This example will probably explain what Iam trying to do better.
>
> $ FILE_TO_DELETE = UDISK1:<USERS...>*.%%%%%%%%;*
> $
> $START:
> $
> $ SEARCH_FILE = F$SEARCH(FILE_TO_DELETE)
> $ FILE_EXT    = F$ELEMENT(0,";",F$ELEMENT(1,".",SEARCH_FILE))
> $ EXT_TYPE    = F$TYPE(FILE_EXT)
> $
> $ IF EXT_TYPE .EQ. "INTEGER"
> $ THEN
> $   DELETE 'SEARCH_FILE;*
> $ ENDIF
> $
> $ GOTO START
> $
>
> No problems when file.12345674 is found this is deleted, but also
> returned
> is file.template which is not deleted so stays on top of the pile, the
> next
> search finds it again.
>
> Does anyone have a solution to this problem.
>
> Regards,
>
>     David






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-09-03  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-09-01  4:00 f$search David Gray
1998-09-01  4:00 ` f$search Bill Henley
1998-09-03  4:00 ` f$search John Cushnie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox