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

Re: Variable usage and log issue.

Sender: Scott Klement <klemscot@xxxxxxxxxxxx>

On Thu, 10 May 2001, Justin Kiteley wrote:
> Hi,
>   My first question has to do with variable usage when calling the various
> API's.  I've looked into FTPAPI_H to find out the types and sizes of the
> variable being used and have matched them but cannot get anything to work
> when passing variables into a program like TESTPUT and then trying to do a
> connect and a put, using passed in values for the API parms.  For example:
> eval      sess = ftp_conn(Host: User: Pass)  This one is not so important, i
> can live with it if it has to be hardcoded, ack.  Right now it does not
> work.
> if        ftp_put(sess:Datafile.file)<0    This one cannot be hardcoded.  As
> long as my current library has the file in it this API should work
> right?  It's not working right now.

These are just normal RPG subprocedures, you can pass variables to them.
Nothing fancy or exciting. :)

What happens when it doesn't work?  What error message does FTP_ERROR

> Am I missing some brackets or something?  Any input would be appreciated.

Brackets?  No.   This works for me:

D Site            S             30A   INZ('ftp.netscape.com')
D User            S             15A   INZ('anonymous')
D Pass            S             15A   INZ('me@xxxxxxxx')
D Filename        S             64A   INZ('/path/to/whatever')

C                   eval      sess = ftp_conn(Site: User: Pass)


C                   if        ftp_put(sess: Filename) < 0

I'm not familiar with things like "Datafile.file".   Are you running
Java?  Or V5R1?  This doesn't look like an RPG variable name to me...

> My second question regards the joblog created during the FTP calls.  Is
> there any way to commit this log to a file instead of the joblog when using
> the API calls?  Thanks for the help!

Not without changing the code...  you could change the DiagMsg routine in
FTPAPIR4 to write the messages wherever you like.  There are a few points
regarding this that I'd like to make, however....

1) If you're writing to a file, and two jobs are running FTPAPI at the
     same time (or even if your job is running two transfers at once)
     the messages in the file will all get mixed together.    

     There are many ways to work around this, of course, such as keying
     the file by job & socket number, and putting those in different
     fields...   or putting the file in QTEMP...   or having a different
     file for each user.

2) You'd need some way to dynamically specify the file and library name,
     if you want this product to be able to work for other people in 
     other shops.

3) It might be wise to put '*****' or something in place of the password
     in the file, rather than putting the password where everyone can
     read it.

4) Another idea would be to structure logging the same way that I've
     structured the FTP_PUTRAW & FTP_GETRAW calls.  (i.e. the user can
      pass a procedure pointer, and have the FTPAPI call that procedure
      to do logging.)  This would allow greater flexibility.

4) If you come up with some good ideas or good code to do this, please
     send them to me or to the list, so we can all try them, and maybe
     integrate them back into the next release of FTPAPI.   Open Source
     software only works if people are willing to contribute :)

This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr