Hi Greg., been traveling without my laptop ( known as holidays ) so sorry for the late reply.
In ftpapi there are callback functionality built in for logging , see ftpapi.exitproc.
I've been using it long time ago like:
for x = 1 to p.ftpcount;
p.handle( x ) = ftp_open( %trimr( p.ipadress( x )): p.ftpport( x ));
if p.handle( x ) < 0;
wxerr = FTP_errorMsg( 0: errnum );
errtxt = 'Error on ftp_open: ' + %trimr( wxerr ) + ' > ' +
%trim( %editc( errnum:'M' )) + ' for ' + %trimr( p.ipadress( x ));
complain( thisp: errtxt );
return *on;
endif;
// Register exit procedure for logging purposes
ftp_exitProc( p.handle( x ): FTP_EXTLOG: %paddr('LOGFTPP'): *null );
// Login to put session
if ftp_login( p.handle( x ): %trimr( p.account( x )): %trimr( p.password( x )) ) < 0;
wxerr = FTP_errorMsg( p.handle( x ): errnum ) + ' > ' + %trim( %editc( errnum:'M' ));
errtxt = 'Error on ftp_login: ' + %trimr( p.account( x )) + ' ' + %trimr( wxerr );
complain( thisp: errtxt );
for x = 1 to p.ftpcount;
ftp_quit( p.handle( x ));
endfor;
return *on;
endif;
// Set passive mode if specified
if p.passive( x );
if ftp_passiveMode( p.handle( x ): *on ) < 0;
wxerr = FTP_errorMsg( p.handle( x ): errnum ) + ' > ' + %trim( %editc( errnum:'M' ));
errtxt = 'Error on ftp_passiveMode ' + %trimr( wxerr );
complain( thisp: errtxt );
for x = 1 to p.ftpcount;
ftp_quit( p.handle( x ));
endfor;
return *on;
endif;
endif;
// Force Binary mode for pdf files
if ftp_binaryMode( p.handle( x ): *on ) < 0;
wxerr = FTP_errorMsg( p.handle( x ): errnum ) + ' > ' + %trim( %editc( errnum:'M' ));
errtxt = 'Error on ftp_binaryMode ' + %trimr( wxerr );
complain( thisp: errtxt );
for x = 1 to p.ftpcount;
ftp_quit( p.handle( x ));
endfor;
return *on;
endif;
endfor;
<------>
// *===============================================================
// * Logftpp Log ftp events put session +
// *===============================================================
dcl-proc Logftpp;
dcl-pi Logftpp;
peMsgTxt char( 256 ) const;
peLogFile int( 10 );
end-pi;
dcl-c thisp 'LogFtpP';
tell( thisp: peMsgTxt: 5 ); ( writes peMsgTxt to a streamfile )
end-proc;
Best regards
Stefan
--
No trees were killed in the sending of this message, but a large number of electrons were terribly upset.
Stefan Tageson
+46 732 369934
stefan@xxxxxxxxxx<mailto:stefan@xxxxxxxxxx>
________________________________
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of Greg Wilburn <gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, December 16, 2025 16:16
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: FTPAPI
I use Scott's LIBFTP (FTPAPI) occasionally instead of an FTP Script when exchanging data.
I would like to have a simple "text" log on the IFS for each FTP session.
With a script, I override OUTPUT to a PF in QTEMP, then using CPYTOIMPF to create the text file.
(As CYA, I typically have DIR or LS in the script before I get and remove files)
With FTPAPI, the logging can go to the joblog by enabling FTP Logging. So, I'm considering using CPYSPLF to send the entire joblog to the IFS.
Just wondering if anyone has done something similar?
TIA,
Greg
[Logo]<
https://www.totalbizfulfillment.com/> Greg Wilburn
Director of IT
301.895.3792 ext. 1231
301.895.3895 direct
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx<mailto:gwilburn@xxxxxxxxxxxxxxxxxxxxxxx>
1 Corporate Dr
Grantsville, MD 21536
[
http://www.totalbizfulfillment.com<
http://www.totalbizfulfillment.com>]www.totalbizfulfillment.com<
http://www.totalbizfulfillment.com>
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/rpg400-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.
As an Amazon Associate we earn from qualifying purchases.