 |
» |
|
 |
|
 |

Copyright (c) Digital Equipment Corporation 1988. All rights reserved
LAYERED PRODUCT or COMPONENT: PLI, VERSION 3.1 OP/SYS: VMS, VERSION 5.0
SOURCE: Digital Customer Support Center
OVERVIEW:
This program demonstrates how to call LIB$FIND_FILE to return a full
file specification when given a partial file specification. It will
return the first file in a directory that fits the search criteria.
CAUTION: This sample program has been tested using:
PRODUCT: PLI, VERSION 3.1 on OPERATING SYSTEM: VMS, VERSION 5.0
However, we cannot guarantee its effectiveness because of the possibility of
errors 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 NOTES:
The program will prompt the user for a partial file specification.
PROGRAM SAMPLE:
ST: proc options(main);
%include LIB$FIND_FILE;
%include $STSDEF;
%include $RMSDEF;
dcl FILE_SPEC char(64);
dcl RESULT_SPEC char(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);
put skip list('Enter the partial file specification:');
get list (FILE_SPEC);
STS$VALUE = LIB$FIND_FILE(FILE_SPEC,
RESULT_SPEC,
CONTEXT,,,,);
if sts$value = RMS$_FNF
then put skip list('File not found');
else if ^STS$SUCCESS
then do;
put skip list('Problems with lib$find_file:',sts$value);
signal VAXCONDITION(STS$VALUE);
end;
else put skip list
('The full file specification is : ',RESULT_SPEC);
end ST;
|
buy online or call 1.800.AT.COMPAQ
|
|