× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, 21 Feb 2002, Mark Allen wrote:
>
> Having a problem with getting this to do what I want.  What I need it to
> do is stay in the FTP session after the dir in the sctipt file (listed
> below) because we do not know what the file name will be.  I want the
> operator to manually enter the appropriate get command but the ftp
> session does an "implicit" quit after the last line of the FTP script
> and the runqry starts.  Can I do wat I want or is the "whole" thing
> going to have to be manual.
>

Err... once you run the FTP command, you can't exit it without
disconnecting from the server.

A *much* easier way to do this would be with my open-source FTPAPI
service program.  It's designed to let you write your own FTP client
with minimal effort, and make it do whatever you like.

Here is an example of how you could do this with FTPAPI (example is
in RPG IV):

 C* Connect to server
 C                   eval      fd = ftp_conn('host': 'userid': 'password')
 C                   if        fd < 0
 c                   eval      Msg = ftp_error
 C*  here you'd want to display the error message "MSG" and then abort
 c                   endif

 C* Change directory
 C                   callp     ftp_chdir(fd: 'pub/SomeDir/Somewhere')

 C* do a "dir" to "my_array", one filename per array entry
 C                   if        ftp_list(fd: '*.txt': 5:
 C                                 %addr(my_array): num_files) < 0
 c                   callp     ftp_error(error_num)
 c                   if        error_num = FTP_NOFILE
 C*  no files were in that directory
 c                   else
 c                   eval      msg = ftp_error
 c*      display error message here
 c                   endif

 C* grab each file in this directory
 C                   for      f = 1 to num_files
 c                   callp    ftp_get(fd: my_array(f): '/localdir/'+
 c                                my_array(f))
 c                   endfor

 C* disconnect from server
 c                   callp    ftp_quit(fd)


Much easier than trying to do the same thing with an FTP script!

If you check the return code from every function (I only did it on
ftp_conn and ftp_list in that example) you'd be able to detect every
error in your transmission without having to parse a complicated
output file.

So, check it out... it's free, and only requires V3R2 or later.
 http://klement.dstorm.net/ftpapi/





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.