Jump to page titleUNITED STATES
hp.com home products and services support and drivers solutions how to buy
» contact hp

:

more options
 

hp.com home
End of Jump to page title
Example-PL/I Use of LIB$FIND_FILE To Wildcard In A Directory
Jump to content



» 

business support center

Home & Home Office Support:
» HP branded products
» Presario branded products
» Services & Warranties
Small & Medium Business Support:
» Small & Medium Business products
» Small & Medium Business services
Support for IT Professionals:
» Enterprise products (IT Resource Center)
» NonStop enterprise products
» Business & IT Services
Content starts here
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
privacy statementusing this site means you accept its terms