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

Re: Problem with ftp_put()



Hi Scott,
thanks for the reply.

No, the problem really was, that on the second Rreadn() the program 
completely terminated without any messages.
It didn't even get back to the putraw procedure.
So, the Msg = ftp_errorMsg(fd) line wasn't executed, too.
The next debugger step just threw me back to the calling program.

Btw, the server doesn't disconnect me, the connection stays open and is 
closed 5 minutes later according to the ftp servers log.

But here's the biggest mystery: 
I just called the program directly from the commandline and everything 
worked as it should be.
Until now, the put program was called in batch.

I thought, that this is maybe an activation group problem or something.
So i compiled everything again.
The calling program has now actgrp *new and the called ftp programs have 
actgrp *caller
All Programs have usrprf *owner (even the ftpapir4 srvpgm).

But still the same.
Then i thought, that maybe the member i want to upload is locked, but it 
isn't... 

I just don't get it.
readn() returns 1200 byte on every cycle.
It reads all 9 lines of the file, adds CRLF and then has 1202 byte in its 
buffer.
Everytime these 1202 byte get sent to the server with tsend().
9 times.
Then readn() is called again. 
This time it should receive EOF since all 9 lines of the file have already 
been read.

 ** Read a record: 
c                   eval      p_RIOFB_t = Rreadn(wkRF: %addr(peBuffer): 
c                                peBufLen: DFT) 

When I press F10 this time, it throws me back to the calling program 
without any messages in the joblog or elsewhere.

I love errors without messages :)

- Martin




-------------
I can't see (from the info you've given) why it would just terminate 
without a message.   The rf_read() procedure (or "read_data") returns 
the length of the data it read.

In put_block(), when that number of bytes is < 1 (i.e. there's no data 
to send to the FTP server) it jumps out of the put_block() routine, 
since there's no data left to send to the FTP server.  In other words, 
everything has been sent, the file transfer is complete.

It then proceeds (in FTP_putraw(), who calls put_block() to begin with) 
to get the FTP server's reply to verify that the file was received 
successfully, and returns control to your program to let you send more 
FTP commands.

So, it doesn't terminate the program!  It just stops sending the file 
because there's nothing to send.  Perhaps there's some other error 
that's happening afterward that you didn't mention in your e-mail?

In your RPG code (that you provided) you have this:

c                   if        ftp_put(fd: zzfile: zzlnam) < 0
c                   eval      Msg = ftp_errorMsg(fd)
c                   callp     ftp_quit(fd)
c                   goto      eget
c                   endif

Basically the way you've coded it, if an error occurs, the error message 
is stored into the variable named "Msg" but nothing else is done with 
it?  Do you ever display it on the screen, or log it to a file or 
anything like that?

The fact that there's no further entries in your job log makes me think 
that the server is disconnecting you.  Otherwise, it would show the 
reply from the server, and the QUIT command being sent from FTPAPI, 
neither of which show up (at least, not in the e-mail you sent.)

If the server is disconnecting, there should be a message in the "MSG" 
variable of your program that tells you what happened.  Have you looked 
at it?
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------