[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with ftp_put()



hi all,
i have a problem with the ftp_put() procedure.
When I call it, the program just terminates without a message.

I traced the problem then and found out, where the program is killed.

This is what I do:

i do a connect
C                   eval      fd = ftp_conn(farsys: 
C                                           farusr: 
C                                           farpas: 
C                                           FTP_PORT:
C                                           120) 

set some stuff
c                   callp     ftp_logging(fd: *On) 
c                   callp     ftp_namfmt(fd: 1)

change to the directory i want to process
c                   if        ftp_chdir(fd: fardir) < 0   
c                   eval      Msg = ftp_errorMsg(fd) 
c                   callp     ftp_quit(fd) 
c                   goto      eftp 
c                   endif 

i get a list of the files on the server
c                   eval      rc = ftp_list(fd: 
c                                           'sz*.txt': 
c                                           20: 
c                                           %addr(incoming): 
c                                           num_files) 

since i download text, i use ascii mode
c                   callp     FTP_binaryMode(fd:*off) 

then i download the files i fount in a loop
c                   if        ftp_get(fd: 
c                                     incoming(fileno): 
c                                     zzlnam)<0 
c                   callp     ftp_quit(fd) 
c                   goto      eftp 
c                   endif 
 

i set the membertext of the new member to the original filename
c                   eval      zzqcmd='CHGPFM '+ 
c 'FILE('+%trim(fallib)+'/'+%trim(falfil)+')'+ 
c                                    'MBR('+%trim(zzlmbr)+') '+ 
c                                    'TEXT('+%trim(incoming(fileno))+')'
c                   callp(e)  qcmdexc(zzqcmd:%len(%trim(zzqcmd))) 

then i change to the backup directory on my ftp
c                   if        ftp_chdir(fd: '../backup') < 0 
c                   eval      Msg = ftp_errorMsg(fd) 
c                   callp     ftp_quit(fd) 
c                   goto      eget 
c                   endif 

and upload the just downloaded member to this backup directory
c                   if        ftp_put(fd: zzfile: zzlnam) < 0 
c                   eval      Msg = ftp_errorMsg(fd) 
c                   callp     ftp_quit(fd) 
c                   goto      eget 
c                   endif 




and this is, where the error happens.
everything until now worked perfect.
the file was downloaded correctly and the membertext was set.
the program even changed to the backup directory

but within the ftp_put() directory something goes wrong.

this is the ftp log:

0: FTPAPI version 2.2 released on 2005-09-20
0: 220 (vsFTPd 2.0.2) 
0: > USER szu 
0: 331 Please specify the password. 
0: > PASS ********** 
0: 230 Login successful. 
0: > SITE NAMEFMT 1 
0: 500 Unknown SITE command. 
0: > CWD /test 
0: 250 Directory successfully changed. 
0: > TYPE A 
0: 200 Switching to ASCII mode. 
0: > PORT 172,30,202,3,40,127 
0: 200 PORT command successful. Consider using PASV. 
0: > NLST sz*.txt 
0: 150 Here comes the directory listing. 
0: 226 Directory send OK. 
0: > TYPE A 
0: 200 Switching to ASCII mode. 
0: > SIZE sz123456.txt 
0: 213 10 
Teildatei SZ000029 zu Datei DEB59P in OFFDTA hinzugefügt.
0: > TYPE A 
0: 200 Switching to ASCII mode. 
0: > PORT 172,30,202,3,40,128 
0: 200 PORT command successful. Consider using PASV. 
0: > RETR sz123456.txt 
0: 150 Opening ASCII mode data connection for sz123456.txt (10 bytes).
0: 226 File send OK. 
Teildatei SZ000029 in Datei DEB59P in OFFDTA geändert. 
0: > CWD ../backup 
0: 250 Directory successfully changed. 
0: > TYPE A 
0: 200 Switching to ASCII mode. 
0: > PORT 172,30,202,3,40,129 
0: 200 PORT command successful. Consider using PASV. 
0: > STOR sz123456.txt 
0: 150 Ok to send data. 

and there it goes boom...


The local membername i wanted to upload is:
ZZLNAM = '/qsys.lib/OFFDTA.lib/DEB59P.file/SZ000028.mbr     ' 


So I debugged the ftp_put() procedure and found out where the problem is:

Somewhere in ftp_put() there is a procedure ftp_putraw() which calls 
ftp_putblock()


And in putblock the program exits here:

 * upload file: 
c                   dou       0 = 1 
C                   eval      wwRC = read_data(peFiledes: %addr(wwBuffer): 
%size(wwBuffer)) 
[...]


The first read_data() works, but when the loop gets processed again, the 
program exits here.

It seems, read_data() is an alias to procedure rf_read() which reads the 
member i want to upload, adds CRLF and then converts it to ascii.
This works in the first cycle (the first record).
In the second cycle Rreadn() within rf_read() fails somehow and the 
program completely quits.

This somehow sucks :)

The file I work with is a standard PF with an record length of 1200.

The Member I processed looked like this:

* . . .  + . . .  . 1 . .  . . + .  . . . 2  . . . .  + . . .  . 3 . .  . 
. + .     *...+....1....+....2....+....3....+. 
A385A2A3 94859482 85994040 40404040 40404040 40404040 40404040 40404040 
40404040   *testmember                          *
                           ****** DATENENDE ******   

With just trailing blanks until 1200 bytes.

Btw, I'm on V5R2.


So, if you know what I'm doing wrong: Any help is appreciated, this drives 
me mad :)

-Martin

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------