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

RE: Variable usage and log issue.



Sender: Buck Calabro <Buck.Calabro@xxxxxxxxxxxx>

Justin Kiteley wrote:

>  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.

What happens?  When you say it doesn't work, what return code are you
seeing?
Here's some code that works for me:

 * API headers                                             
d/COPY FTPAPISRC,FTPAPI_H                                  
                                                           
d ftp             S             10I 0                      
d Msg             S             52A                        
d fromSys         s             64a                        
d fromUser        s             64a                        
d fromPass        s             64a                        
d fromFile        s            128a                        
d interFile       s             32a   inz('/ftpInterFile') 

c     *entry        plist                              
c                   parm                    fromSys    
c                   parm                    fromUser   
c                   parm                    fromPass   
c                   parm                    fromFile   
                                                       
c* Connect to the "from" FTP server.                   
c                   eval      ftp = ftp_conn(fromSys:  
c                                            fromUser: 
c                                            fromPass) 
c* ftp_error will contain                              
c*  an error msg if ftp is < 0                         
c                   if        ftp < 0                  
c                   eval      Msg = ftp_error          
c                   dsply                   Msg        
c                   eval      *inlr = *on              
c                   return                             
c                   endif                              
...

>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?  

If you look in FTPAPIR4, you'll see that the logging is done in a procedure
named DiagMsg.  It uses the "send message" API to do the logging.  It would
be fairly straightforward to change that to log to a database file instead
of calling QMHSNDPM.  If you want to hit that, there are several approaches:

1) Just change DiagMsg to hit the DB instead of the job log
2) Add global variables to control which one DiagMsg hits, and what the file
name is, etc.
3) Create a new procedure DiagMsgToDB that is called by DiagMsg.  I'd also
change FTP_Log to add parameters for "where to log" and "Log file
name/lib/member/path."  If we allow logging to a stream file (why not?) then
we may even want some more procs to create/add "records"...

Just some ideas
Buck Calabro
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubsribe from the list send mail
to majordomo@xxxxxxxxxxxxx with the body: unsubscribe ftpapi mymailaddr
-----------------------------------------------------------------------