Hello,
When I call FTP_exitProc with FTP_EXTLOG as the exit point, if only logs the the login info below. I just realized this is true from reading the documentation and saw the FTP_EXTSTS parameter for file transfer status that I am looking for.
220 iVan FTP server VAL3 ¬24189| (version 4.8.25293.1222) ready.
> AUTH TLS
Switching control channel to Tls, Tls11, Tls12, Tls13
> USER easc
331 Password Required for easc.
> PASS **********
230 User easc@abc.com logged in.
> PBSZ 0
200 Protection Buffer Size 0 accepted
> PROT P
200 data connection will be secure
> TYPE I
200 type set
I made another call with with FTP_EXTSTS as the exit point to log the status of the file transfer but I get this error on the put command.
Pointer not set for location referenced.
The call to FTP_PUT ended in error (C G D F).
? D
The call to FTP_PUT ended in error (C G D F).
? D
Application error. MCH3601 unmonitored by FTPSTEST at statement
0000000848, instruction X'0000'.
Any help or advice please. Thank you
FTP_exitProc
-
Scott Klement
- Site Admin
- Posts: 963
- Joined: Sun Jul 04, 2021 5:12 am
Re: FTP_exitProc
we need to see your code to fully understand what you are describing.
-
Scott Klement
- Site Admin
- Posts: 963
- Joined: Sun Jul 04, 2021 5:12 am
Re: FTP_exitProc
The FTP_EXTSTS expects parameters the same as (or at least compatible with) this:
You are passing %paddr(Logger), and logger's parameters aren't compatible, so you will be guaranteed to get pointer errors.
Code: Select all
D StatusProc PR
D peBytes 16P 0 value
D peTotBytes 16P 0 value
D peExtra * value
Re: FTP_exitProc
Scott,
Ok I must have misunderstood the usage of the FTP_EXTSTS. Now I see it provides a status and byte count of a file transfer. I am actually looking for a way to capture the list of files from the FTP_LIST call for logging.
Here's part of the code with the FOR loop with FTP_GET and where I log each filename downloaded to the log file. This works perfectly now.
// get a list of files
rc = ftp_list(ftp: mget:
%elem(incoming):
%addr(incoming): num_files);
nbrfiles = num_files;
B01 if rc<0;
callp ftp_errorMsg(ftp:ErrNum);
B02 if ErrNum = FTP_NOFILE;
num_files = 0;
X02 else;
callp ftp_quit(ftp);
*inlr = *on;
return;
E02 endif;
E02 endif;
if ftp >= 0;
ftpdts = %timestamp();
srctag = 'LIST';
srctxt = ' ';
ftptxt = 'FTP_list ' + %trim(mget) +
' found ' + %char(num_files) + ' file(s)';
write ftplog1;
ENDIF;
// get each file to IFS
// to '/transfer/pfx/download/'
for f = 1 to num_files;
// lets bail if more files than size of array
if f > %elem(incoming);
leave;
endif;
ibmEdi = incoming(f);
ibmFile = ibmDownload + %trim(ibmEdi);
ibmEdiFile = ibmEdi;
setll ibmEdiFile ibmedilog1;
ibmEdiRcvd = %equal();
// delete target file in IFS
// cmd = 'del ''' + %trim(ibmFile) + '''';
// cmdLen = %len(%trim(cmd));
// callp(e) cmdExc(cmd: cmdLen);
// ##02 use unlink to delete IFS files
rc = unlink(%trim(ibmfile));
// get file
B01 if ftp_get(ftp: ibmEdi: ibmFile) < 0;
msg = ftp_errorMsg(ftp);
if msg <> mailboxEmpty;
ftpdts = %timestamp();
srctag = 'GETDTA';
srctxt = 'GET: ' + %trim(ibmEdi) +
' to: ' + %trim(ibmFile);
ftperr = %trim(ftp_errorMsg(0));
write ftperrlog1;
callp ftp_quit(ftp);
callp(e) ftpgetibme(ibmedi: msg); // email the error message
leave;
E01 endif;
E01 endif;
if ftp >= 0;
ftpdts = %timestamp();
srctag = 'GET';
srctxt = ' ';
ftptxt = 'FTP_get ' + %trim(ibmEdi);
write ftplog1;
ENDIF;
Ok I must have misunderstood the usage of the FTP_EXTSTS. Now I see it provides a status and byte count of a file transfer. I am actually looking for a way to capture the list of files from the FTP_LIST call for logging.
Here's part of the code with the FOR loop with FTP_GET and where I log each filename downloaded to the log file. This works perfectly now.
// get a list of files
rc = ftp_list(ftp: mget:
%elem(incoming):
%addr(incoming): num_files);
nbrfiles = num_files;
B01 if rc<0;
callp ftp_errorMsg(ftp:ErrNum);
B02 if ErrNum = FTP_NOFILE;
num_files = 0;
X02 else;
callp ftp_quit(ftp);
*inlr = *on;
return;
E02 endif;
E02 endif;
if ftp >= 0;
ftpdts = %timestamp();
srctag = 'LIST';
srctxt = ' ';
ftptxt = 'FTP_list ' + %trim(mget) +
' found ' + %char(num_files) + ' file(s)';
write ftplog1;
ENDIF;
// get each file to IFS
// to '/transfer/pfx/download/'
for f = 1 to num_files;
// lets bail if more files than size of array
if f > %elem(incoming);
leave;
endif;
ibmEdi = incoming(f);
ibmFile = ibmDownload + %trim(ibmEdi);
ibmEdiFile = ibmEdi;
setll ibmEdiFile ibmedilog1;
ibmEdiRcvd = %equal();
// delete target file in IFS
// cmd = 'del ''' + %trim(ibmFile) + '''';
// cmdLen = %len(%trim(cmd));
// callp(e) cmdExc(cmd: cmdLen);
// ##02 use unlink to delete IFS files
rc = unlink(%trim(ibmfile));
// get file
B01 if ftp_get(ftp: ibmEdi: ibmFile) < 0;
msg = ftp_errorMsg(ftp);
if msg <> mailboxEmpty;
ftpdts = %timestamp();
srctag = 'GETDTA';
srctxt = 'GET: ' + %trim(ibmEdi) +
' to: ' + %trim(ibmFile);
ftperr = %trim(ftp_errorMsg(0));
write ftperrlog1;
callp ftp_quit(ftp);
callp(e) ftpgetibme(ibmedi: msg); // email the error message
leave;
E01 endif;
E01 endif;
if ftp >= 0;
ftpdts = %timestamp();
srctag = 'GET';
srctxt = ' ';
ftptxt = 'FTP_get ' + %trim(ibmEdi);
write ftplog1;
ENDIF;


