Hallo All,
I use for a long time (since 2002) Scott Klement's FTP-APIs for file
transmissions and I'm still enthused with this software.
Recently I discovered a problem, when I tried to process a directory wherein
a subdirectory was located.
Here my example:
1. The directory "/testin" has 2 entries:
pampr.tst STMF
templates DIR
2. My application program code is (shortened):
rc = FTP_List(fd:' ':99:%addr(incoming):num_files); <--- List the
directory entries
For fileno = 1 to num_files;
<--- Loop for processinf the contents
#File256 = %trimr(incoming(fileno));
// Check if file name is a directory
If FTP_Chdir(fd:%trimr(CJRMTPTH) + '/' + #File256) >= *zeros;
Iter;
EndIf;
// Check if file matches generic name
If CJGENNAM <> *blanks;
If %scan('*':CJGENNAM) > *zeros;
If pr$ChkGen(#File256:CJGENNAM) = *off;
Iter;
EndIf;
Else;
If #File256 <> CJGENNAM;
Iter;
EndIf;
EndIf;
EndIf;
// Transfer upload file from remote system to iSeries
If FTP_Get(fd:#File256:%trimr(CJLOCPTH) + '/' + #File256)
< *zeros;
r$FTPErrMsg = FTP_Error();
#FTP0004_01 = r$FTPErrMsg;
3. The problem:
In the first cycle of the FOR loop I get the subdirectory "templates".
The file name in my work field #File256 is "templates/".
The FTP_Chdir recognizes it as a directory and the ITER is processed
correctly.
The second cycle supplies the file name " pampr.tst" in my workfield
#File256. This file should be processed with
the FTP_Get API. My debugger realy shows only "pampr.tst" in field
#File256 straight before the FTP_Get command
line.
After the FTP_Get was executed, I receive error:
R$FTPERRMSG = ' Unable to find file /testin/templates/pampr.tst'.
Why appears "templates" in the pathname?
If there is no subdirectory in the directory everything works correctly.
What did I miss? What I'm doing wrong?
Many thanks in advance for any ideas and suggestions.
Kind regards,
Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 9
D-63739 Aschaffenburg
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: Werner.Noll@xxxxxxxxx <outbind://5/Werner.Noll@xxxxxxxxx>
Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 9
D-63739 Aschaffenburg
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: Werner.Noll@xxxxxxxxx <outbind://5/Werner.Noll@xxxxxxxxx>