 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1985. All rights reserved
OVERVIEW:
This article contains an example of how to use LIB$FIND_FILE to find the
first file in the default directory, then delete it.
CAUTION: This sample program has been tested using PLI V2.2 on VAX/VMS
V4.1. However, we cannot guarantee its effectiveness because of the
possibility of error in transmitting or implementing it. It is meant to be
used as a template for writing your own program, and it may require
modification for use on your system.
PROGRAM EXAMPLE:
ST: PROCEDURE OPTIONS(MAIN);
%INCLUDE $STSDEF;
DCL FILE_SPEC CHARACTER(64);
DCL RESULT_SPEC CHARACTER(64);
/* The CONTEXT variable is returned on the first call to LIB$FIND_FILE.
The CONTEXT variable contains the address of the RMS FAB structure.
On subsequent calls, you need to pass the CONTEXT variable back with
its contents intact in order for the previous FAB structure to be
deleted and/or the channel deassigned. If you don't and if you call
the routine more times than the value of the sysgen parameter
CHANNELCNT, the routine call will fail. */
DCL CONTEXT FIXED BIN(31) INIT(0);
DCL LIB$FIND_FILE EXTERNAL ENTRY
(CHARACTER(*),
CHARACTER(*),
FIXED BIN(31),
ANY,ANY,ANY,ANY) OPTIONS(VARIABLE) RETURNS(FIXED BIN(31));
DCL LIB$DELETE_FILE EXTERNAL ENTRY
(CHARACTER(*),
ANY,ANY,ANY,ANY,ANY,ANY,ANY,ANY)
OPTIONS(VARIABLE) RETURNS(FIXED BIN(31));
/* Set the file spec for a wildcard file search. It will find the first file
in the default directory. */
FILE_SPEC = '*.*.*';
STS$VALUE = LIB$FIND_FILE(FILE_SPEC,
RESULT_SPEC,
CONTEXT,,,,);
IF ^STS$SUCCESS THEN SIGNAL VAXCONDITION(STS$VALUE);
STS$VALUE = LIB$DELETE_FILE(RESULT_SPEC,,,,,,,,);
IF ^STS$SUCCESS THEN SIGNAL VAXCONDITION(STS$VALUE);
PUT SKIP LIST('FIRST FILE IN YOUR DIRECTORY WAS: ',RESULT_SPEC);
END ST;
|
buy online or call 1.800.AT.COMPAQ
|
|