[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: determine existance of a remote library



If you're just looking to determine if a given library name exists, then 
FTP_chdir() is a good option (though, do remember that your current 
library in the FTP session changes when you execute the command...)

Also note that FTP_chdir() doesn't know the difference between a *LIB 
object and a *FILE object, or an IFS directory.  But this shouldn't 
matter if you're manually concatenating .LIB to the name.

The alternative (especially if you don't know the library name) is to 
make sure the server is in namefmt 1, and then get a list of the files 
in the QSYS library.  Any filename ending in .LIB in the QSYS library 
will be a *LIB object on the system.  (This doesn't work in namefmt 0 
for some reason, though)


Brian@xxxxxxxxxx wrote:
>    We have a utility that uses the FTPAPI to pass libraries between
>    System i's.
>    If the user chooses to do a get we are currently using FTP_List to
>    check for the existance of the library on the remote server.  Here's
>    the code:
>    IfsFileName = '/QSYS.LIB/' + %TRIM(LibName) + '.LIB';
>    rtnCode = FTP_List(Session:IfsFileName:1:%ADDR(rtnFile):rtnCount);
>    IF rtnCode = -1 OR rtnCount = 0;
>      MsgText = 'The library ' + %TRIM(LibName)
>                 + ' does not exist on the remote system.';
>      AnyErr = YES;
>      EXSR Exit;
>    ENDIF;
>    We recently discovered that a library with out any files (i.e.
>    programs only) will show as an empty list and be considered not there.
>    Is there a better way to check for the existance of a library on a
>    remote server?  Perhaps FTP_Chdir?
>    Brian J. Garland
>    Vermont Information Processing, Inc.
>    brian@xxxxxxxxxx
> 
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------