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



Thank you all for your suggestions... really great stuff!

I did some test runs and really like Marco's solution (thank you!).
The output from DSPJOBLOG is a bit more than what I am was looking for.

Here's a sample of the output text file (log) from a test run:

2025-12-17-09.59.17.892270 - 0: FTPAPI version 2.9 released on 2025-10-08
2025-12-17-09.59.17.980745 - 0: 220 ProFTPD Server (MY REPORTS FTP) [255.255.255.1]
2025-12-17-09.59.17.980868 - 0: > AUTH TLS
2025-12-17-09.59.18.011239 - 0: AUTH TLS successful
2025-12-17-09.59.18.058242 - 0: > USER myusername
2025-12-17-09.59.18.124113 - 0: 331 Password required for myusername
2025-12-17-09.59.18.124183 - 0: > PASS **********
2025-12-17-09.59.20.129231 - 0: 230 User myusername logged in
2025-12-17-09.59.20.129367 - 0: > PBSZ 0
2025-12-17-09.59.20.151822 - 0: 200 PBSZ 0 successful
2025-12-17-09.59.20.151945 - 0: > PROT P
2025-12-17-09.59.20.174093 - 0: 200 Protection set to Private
2025-12-17-09.59.20.174753 - 0: > CWD test
2025-12-17-09.59.20.200332 - 0: 550 test: No such file or directory
2025-12-17-09.59.20.211448 - Record in file QSYSPRT truncated at end of line.
2025-12-17-09.59.20.221515 - I
2025-12-17-09.59.20.211456 - Record in file QSYSPRT truncated at end of line.
2025-12-17-09.59.20.221511 - I
2025-12-17-09.59.20.221948 - 0: > QUIT
2025-12-17-09.59.20.246176 - 0: 221 Goodbye.

Charles - I thought about updating FTPAPI to write to the IFS... but then I would need to maintain that anytime we update LIBFTP.

Thanks all!

Greg

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Marco Facchinetti
Sent: Tuesday, December 16, 2025 4:34 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: FTPAPI

Hi Greg, store a timestamp before FTPAPI invocation and when is done store
a new one.

Dcl-s NulInd int(5) inz(0) dim(5);
Dcl-s i int(10);
Dcl-s l int(10);
Dcl-s nFileOut varchar(200) inz('');
Dcl-s LineOut varchar(2000);
Dcl-s TsBegin timestamp;
Dcl-s TsEnd timestamp;

Dcl-Ds wSql qualified;
Ts timestamp;
Txt varchar(1024);
JobName varchar(28);
End-Ds;

EXEC SQL SET OPTION COMMIT = *NONE;

TsEnd = %timestamp();
TsBegin = TsEnd - %minutes(5);

exec SQL DECLARE C1 CURSOR FOR
SELECT MESSAGE_TIMESTAMP, MESSAGE_TEXT , QUALIFIED_JOB_NAME
FROM TABLE (QSYS2.JOBLOG_INFO('*'))
WHERE MESSAGE_TEXT IS NOT NULL
AND MESSAGE_TIMESTAMP BETWEEN :TsBegin AND :TsEnd;
exec sql Open C1;
for i = 1 to 100000;
exec sql fetch C1 into :wSql:NulInd;
if sqlcod <> 0;
leave;
EndIf;
if nFileOut = '';
wSql.JobName = %scanrpl('/':'_':wSql.JobName);
nFileOut = '/tmp/' + wSql.JobName + %char(%timestamp()) + '.log';
EndIf;
LineOut = %char(wSql.Ts) + ' - ' + wSql.Txt;
exec sql CALL QSYS2.IFS_WRITE_UTF8(PATH_NAME => :nFileOut,
LINE => :LineOut,
OVERWRITE => 'APPEND',
END_OF_LINE => 'LF');

EndFor;

exec sql Close C1;

*inlr = *on;
Return;

HTH


--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco


Il giorno mar 16 dic 2025 alle ore 20:07 Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> ha scritto:

And.. I'm not sure how to put the code below in an rpg program with "exec
sql"

The filename and path would always be variable.


I'm not 100% sold on using the joblog - it's way to verbose for what I
want. I would like to just see the FTP commands and results (i.e. like you
would see in an interactive session)

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Marco
Facchinetti
Sent: Tuesday, December 16, 2025 12:04 PM
To: RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: FTPAPI

With Sql it's very easy:

BEGIN
CALL QSYS2.IFS_WRITE(
PATH_NAME *=>* '/tmp/logsample',
LINE *=>* '',
FILE_CCSID *=>* *1200*,
OVERWRITE *=>* 'REPLACE',
END_OF_LINE *=>* 'NONE'
);
FOR SELECT (*CHAR*(MESSAGE_TIMESTAMP) || ' - ' || MESSAGE_TEXT) AS
LOGLINE
FROM TABLE (
QSYS2.JOBLOG_INFO('216955/MYUSER/MYJOB')
)
DO
CALL QSYS2.IFS_WRITE(
PATH_NAME *=>* '/tmp/logsample',
FILE_CCSID *=>* *1200*,
LINE *=>* LOGLINE,
OVERWRITE *=>* 'APPEND',
END_OF_LINE *=>* 'CRLF'
);
END FOR;
END;

HTH
--
Marco Facchinetti

Mr S.r.l.

Tel. 035 962885
Cel. 393 9620498

Skype: facchinettimarco


Il giorno mar 16 dic 2025 alle ore 16:16 Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> ha scritto:

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/___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OjFmMDQ6MzdjZWRjMjcxOTU1NmMyYWEyOTJhMjU0NTJlOTBiZTEyNjA1NGFiMTcyMGVlZDMzOWZjYjU2Y2UzZjY1YzVmYTpwOlQ6Rg>
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/___www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OjE3MzA6Y2RjMjcwM2Q2NmRlYzFjZjE0MGY1NWQ1ZDM4NDZkZjM2NjVjM2NhN2M0MGI5MmQ2M2RlNTYwZjdiMDA3MWM2MDpwOlQ6Rg
<
https://protect.checkpoint.com/v2/r01/___http://www.totalbizfulfillment.com___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OmUxODY6NjgyMTU2Nzk0MTBiMzQ2ZDc1MWMwMGMzZGI3MjZiYzUzYWFkOWNlYTgwYzI3ZDQyMzRmMmZhYjE5NTk1YzA0YTpwOlQ6Rg

--
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OmY2YmU6NjdlMjI4ZDdkZjhiODI2YmZkYjIyYjkzOTc1Y2ZjMmM0NjUyMWFiOTMyNDU1NjJmMjRlODU1Y2I4MDk5MjE0OTpwOlQ6Rg
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OjFiN2I6MTZmNmM2YjUwMmI3NDFjMGIwMDYyZTJkNjJjY2ZhOTAwM2JmZGVjZTQwNTYzZTRiZjViZDU3MmEyYmU3YjJiMTpwOlQ6Rg
.

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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OmRiNmQ6MWY0OWUzZjRkNzVkMjQxNWNmNWExZGYzY2E5MjhiMjQxMTIzNjE3ZDIwNmIyMDA3OWRiY2VkYTVhMTgyMDM0ODpwOlQ6Rg
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzplYTE0YmZlMWIxMjFhNTMzMDhkYTQ0Y2Y2OTAzYzY2Mjo3OmVjNzE6YTk4MWYzYTI1NTllNGVlYjhlODBlMzIxMzZiOWQ0M2Y2Y2Y1ODVmZTZlMDUxZDdkYmM4MDU4ZTBhYzNiNzFhMTpwOlQ6Rg
.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



Greg Wilburn
Director of IT
301.895.3792 ext. 1231
--
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphZTY4NDNlZDkzODJiMThiNmI4OTU4NmY3YzQ4ZmVkMTo3OjUxNzI6MzFlZDE5MjVmNDQwYWJjNTEwMjMwYjQ2MjlhNmIyZTFkNGIzMTZkNzg4ZGYyNzgwNDM2ZmQ5NmZjNDAyYzkyMjpwOlQ6Rg
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphZTY4NDNlZDkzODJiMThiNmI4OTU4NmY3YzQ4ZmVkMTo3OjNjYTc6NGEzYTY5NzE1OGYxMWQ5MmMzMzQxOTk0ZTAzN2M4NjYzZTU5MDVjNzcxN2Y2NmQxYTM4Yjc4MzFiYjA3NDcwNjpwOlQ6Rg.

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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphZTY4NDNlZDkzODJiMThiNmI4OTU4NmY3YzQ4ZmVkMTo3OjU1NGE6MzI3MTQ3ZjQyYTU0NWRlOThjNjUzMGE2ZGQ5NzcwYWUyZWMyN2YzZmMzZTFiMmY3M2M5NGU5NTQyMWI0MWZjMTpwOlQ6Rg
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___.YzJ1OnRvdGFsYml6ZnVsZmlsbG1lbnQxOmM6bzphZTY4NDNlZDkzODJiMThiNmI4OTU4NmY3YzQ4ZmVkMTo3OjE2MWY6ODBkZjA2NWJhNTQwOGQxMGM5YTE2MmViYWIwMTUxN2U5ZGRjMzZlNzIzODE3YjJlN2JkNDhkOWI5YTBiZjU3MzpwOlQ6Rg.

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.