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



Stefan,

Thank you! I see that now in one of the examples (TEST2SESS).

I created a procedure in an existing "IFS" service program, using the code in Marco's reply. I called it "IFS_WriteJoblog"

Input: Begin Timestamp
Path & Filename (optional): Places joblog in /tmp if omitted

dcl-pr Ifs_WriteJoblog ind;
inBeginTs timestamp const;
inStmf varchar(256) const options(*nopass);
end-pr;

This will create a log file on the IFS for any program I need...

Inside my FTP programs, I can use the SND-MSG opcode to add my own info to the job log.

So far it is working great!

I'll keep this for future FTP projects.

Thank you again!
Greg

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of stefan@xxxxxxxxxx
Sent: Thursday, December 18, 2025 10:50 AM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: FTPAPI

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://protect.checkpoint.com/v2/r01/___https://www.totalbizfulfillment.com/___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OjI0MTA6MzMzMDdjZTZkMmNiYzhkZmE3ODI2Y2VjNjkyMWMzMjMxZDcyOTA4ZjE3YzU4ZmUxNGQ1NTFmOWE1Njk1OGY4ZjpwOlQ6Rg> 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
[https://protect.checkpoint.com/v2/r01/___http://www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OjY2YmE6YTYxN2FmMjMzMTk2MDRhNzE5ZTE2NGZhNjk0NDVmMWY4OGEyNDM1NzYyZjRkMTRkMTVhZTdhMzBhMTUxMGNjZTpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___http://www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OjdlOWQ6MWI5NWY2OGRiOWMyNTdkOGUxMzRhMTkxMzk1MjM1ZDNkZGQ3MTk2OGEzYjg5YjE0Y2NjNTJkZjc4YjliNDQ0NTpwOlQ6Rg>]https://protect.checkpoint.com/v2/r01/___www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OmE5ZjQ6OWFhZGEzZjE4ZmY4NDU5YzliZmJiNjI1YjY4ODg3YTczMTNiNmY4MjdjNTIzNTViNzcxYTViMmVhYTMwZGQ3MTpwOlQ6Rg<https://protect.checkpoint.com/v2/r01/___http://www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OmE0MWI6N2UyOWZjYzE0YjQ2ZGFlYzFjZmZhMmIzOWE3MjgyMzFlN2MzYWY0ZWY1ZWRmNmRkNWUxMGNjZTgzZmZlZmRkNzpwOlQ6Rg>
--
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://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/mailman/listinfo/rpg400-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OmE5MDI6ZjE0Y2EwYWNiMjVhZGZmMzhjMTA2ZDZkNGUyYjIxZjU3ODlkMjllMmNjODIwMjI4OGQ2YTg0NGZmNDZjZjk2ZDpwOlQ6Rg
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/rpg400-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OmQ0Yjk6ZjRjN2QwZmNmNjE2MmM5ZDRlNDJkNTMyMWE3ZDQwY2E1YjYyYmY4MDdmZDljZmViOGViOWJhOWNiM2MwMDM3YjpwOlQ6Rg.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

--
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://protect.checkpoint.com/v2/r01/___https://lists.midrange.com/mailman/listinfo/rpg400-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OjZlMDc6MTU0MTRkNmNiMTkwMTI4NGI3OTQ0ZTFmNDkyNzU4ZmFkNWNmYjU1Mjk2ZjQxOThmOGZmYmY3MWFhMmE3MWI0NjpwOlQ6Rg
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://protect.checkpoint.com/v2/r01/___https://archive.midrange.com/rpg400-l___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzozNGUxYWU2Mzk1ODZjNGNkNGE4NjQ3YTg4ZDdkODY1YTo3OjZhN2Q6MDc3MjEyMjhkYTJlNmI4ODMyZGU2OTIzMGYwMzQzNGZjNmJhYjI0YWU5OWRlOTVlYTJiYzRhZWYzZjgwM2MwZjpwOlQ6Rg.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



Greg Wilburn
Director of IT
301.895.3792 ext. 1231

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.