Gary,
I created a process for SFTP, using a CL and RPGLE pgm., using the output spoolfile.
I'm sure the same concept could be applied to FTP.
Instead of looking for "Uploading" or "Fetching"
Search for either "Transfer complete" or "bytes transferred" for a success.
0033.00 226 Transfer complete, 1,368.4 KB/s
0034.00 327888 bytes transferred in 0.229 seconds. Transfer rate 1434.860 KB/sec.
0058.00 RTVJOBA JOB(&JOBNAME) USER(&JOBUSER) NBR(&JOBNUM)
0059.00
0060.00 CRTPF FILE(QTEMP/SFTPLOG) RCDLEN(136)
0061.00 MONMSG MSGID(CPF0000)
0062.00
0063.00 CPYSPLF FILE(QPRINT) TOFILE(QTEMP/SFTPLOG) +
0064.00 JOB(&JOBNUM/&JOBUSER/&JOBNAME) +
0065.00 SPLNBR(*ONLY) CTLCHAR(*PRTCTL)
0066.00
0067.00 CALL PGM(SFTPLOG) PARM(&OK)
0069.00 IF COND(&OK *NE 'Y') THEN(DO)
0070.00 SNDMSG MSG('SFTP Test Transfer failed') +
0071.00 TOUSR(PAULS) /* T */
0072.00 ENDDO
0073.00
0074.00 IF COND(&OK *EQ 'Y') THEN(DO)
0075.00 SNDMSG MSG('SFTP Test Transfer Successful') +
0076.00 TOUSR(PAULS) /* T */
0009.00 **************************************************************************
0010.00 Fsftplog ipe f 136 disk
0011.00 **************************************************************************
0012.00
0013.00 dsearchfor s 10
0014.00 dpos s 4s 0
0015.00 **************************************************************************
0016.00 * Input Parameters
0017.00 isftplog AA 01
0018.00
0019.00 * Record type
0020.00
0021.00 i 1 136 irec
0022.00 **************************************************************************
0023.00 C *ENTRY PLIST
0024.00 C PARM OK 1
0025.00
0026.00 c eval searchfor = 'Uploading'
0027.00 c exsr search
0028.00
029.00 c if pos <> 0
0030.00 c eval ok = 'Y'
0031.00 c endif
0031.01
0031.02 c eval searchfor = 'Fetching '
0031.03 c exsr search
0031.04
0031.05 c if pos <> 0
0031.06 c eval ok = 'Y'
0031.07 c endif
0032.00
0033.00 **************************************************************************
0034.00 C search begsr
0035.00 **************************************************************************
0036.00
0037.00 /free
0038.00
0039.00 pos = %scan(searchfor: irec :1);
0040.00
0041.00 /end-free
Paul
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Young
Sent: Monday, July 07, 2014 3:43 PM
To: Midrange Systems Technical Discussion
Subject: Re: Process FTP Output log
Gary,
Others here will suggest that you use Scott Kelments' FTPAPI utility that will give you finer control and total error handling.
If you want to process the FTP Output Log, I would suggest that you create a Source File and prior to the FTP command issue an OVRDBF command as
follows:
OVRDBF FILE(OUTPUT) TOFILE(your file) TOMBR(your member).
The file name OUTPUT is used by FTP to write the output log.
Jeff Young
Sr. Programmer Analyst
On Mon, Jul 7, 2014 at 3:38 PM, Gary Thompson <gthompson@xxxxxxxxxxx> wrote:
I am looking for a quick way to process output FTP session "logs".
We have a "never-ending" job which monitors for customer deliveries
which are ready and creates and sends an EDI 856 ASN (actually an
imitation) via FTP.
One need is to know if the FTP was successful.
This job creates two spool files for each FTP step, one with input
commands and the other with output. During the course of a day there
are over 200 of these files so I need to read the most recent FTP
output spool, which can be identified by the three parts of file:
Name, Device or Queue and User Data.
My current idea is to scan for 'bytes transferred'
I've worked with spool API's but not here and not for some time but a
link to the API name and any/all hints will be much appreciated.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take
a moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.