IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Empty file creation on receiver end for FTP PUT command


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
cma rajith

New User


Joined: 28 May 2008
Posts: 30
Location: India

PostPosted: Tue Sep 09, 2008 7:26 pm
Reply with quote

Hi,

With FTP PUT command, if the server connection is failing before file transfer completion , at the receiver side an empty file is getting created.

How can this be avoided..

The ftp comand we are using is as follows.

Code:

//FTPCALM EXEC PGM=FTP,PARM='69.18.217.42 (EXIT',COND=(0,NE),   
//             REGION=8M                                       
//STEPLIB DD DSN=SYS1.SCEERUN,DISP=SHR                         
//SYSTCPD DD DSN=SYS1.TCPPARMS(TCPDATB0),DISP=SHR                                               
//INPUT     DD *                                               
ftp_ibm                                                         
&CISIOLPW                                                       
cd CALM/IN                                                     
pwd                                                             
binary                                                         
SITE PRI=100 CYLINDERS SEC=10 CYLINDERS                         
PUT 'IOLDI.JAPAN.CALM.FTP' JPN.CALM.INV1.D&OYMD1.T&OHHMM                                                     
quit

The error is as below:

SITE PRI=100 CYLINDERS SEC=10 CYLINDERS
>>> SITE PRI=100 CYLINDERS SEC=10 CYLINDERS
nd not understood.
Command:
PUT 'IOLDI.JAPAN.CALM.FTP' JPN.CALM.INV1.D080904T1201
>>> SITE FIXrecfm 119 LRECL=119 RECFM=FB BLKSIZE=11900
nd not understood.
>>> PORT 9,56,230,201,13,215
nd okay.
>>> STOR JPN.CALM.INV1.D080904T1201
ng BINARY mode data connection for JPN.CALM.INV1.D080904T1201.
Connection to server interrupted or timed out. Waiting for data connect
*** I can't open a data-transfer connection:
open data connection.
Std Return Code = 27425, Error Code = 00009
>>> QUIT
But receiver end says the file they got with size 0kb.

Can we control this empty file creation..?Can anybody help..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Sep 09, 2008 7:46 pm
Reply with quote

It looks like you're having a couple of problems. Try changing
Code:
SITE PRI=100 CYLINDERS SEC=10 CYLINDERS
PUT 'IOLDI.JAPAN.CALM.FTP' JPN.CALM.INV1.D&OYMD1.T&OHHMM
to
Code:
QUOTE SITE PRI=100 CYLINDERS SEC=10 CYLINDERS
SENDSITE
PUT 'IOLDI.JAPAN.CALM.FTP' JPN.CALM.INV1.D&OYMD1.T&OHHMM


As far as I am aware, you cannot prevent FTP from creating files if they don't exist -- that's kind of the purpose of FTP, you know.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Sep 09, 2008 10:33 pm
Reply with quote

Hello,

You might detect the failure and when the transfer fails, send a file delete to the remote - this might be a separate step in the jcl.

You might also consider sending the file with an "in process" file name rather than the "real" name and after the transmission is successful, rename it to the desired file name.

Either should prevent a "real" file of zero length being left on the target system.

Another thought might be to have the remote "pull" the data rather than using the mainframe to "push". The transfer would then be under control of the remote and whether to terminate or re-try could be made at the target.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Sep 10, 2008 12:55 am
Reply with quote

cma rajith wrote:
receiver end says the file they got with size 0kb.


Seems to me that this should be their problem to deal with, not yours.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 10, 2008 2:40 am
Reply with quote

Hello,

If the receiver pulled the file and there were problems, i'd agree.

If my PUT fails and leaves "bad stuff" on their machine, i suspect i should handle it icon_question.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Sep 10, 2008 3:24 am
Reply with quote

Dick, I think it'll vary by circumstances ... in the messages posted originally, the command not found errors should definitely be handled on the mainframe side. On the other hand, if the FTP signon doesn't have permissions to write to the directory, or the mount point is full, the PUT can fail and there's not much the mainframe side can do about it.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Sep 10, 2008 5:47 am
Reply with quote

Hi Robert,

Quote:
I think it'll vary by circumstances ...
Yes - i agree the way you've assigned "who should handle".

I should have more clear.

If the "mainframe push" transmission gets started (no errors in control file, no connecton/permission errors on the target, etc) successfully but does not complete successfully, the mainframe process should ensure that an empty (or probably worse, a partial) file does not remain on the target.

IMHO icon_smile.gif
Back to top
View user's profile Send private message
MBabu

Active User


Joined: 03 Aug 2008
Posts: 400
Location: Mumbai

PostPosted: Wed Sep 10, 2008 1:23 pm
Reply with quote

hard to tell, but it looks like a firewall problem where ftp can't establish the outgoing connection and you need a passive connection. try locsite EPSV though that must be configured and your system must be 1.5 or later. the fto command for passive connections is PASV but that requires more than just entering the command because it returns a port number that must be opened. ask your network people what is going on. They may know best
Back to top
View user's profile Send private message
cma rajith

New User


Joined: 28 May 2008
Posts: 30
Location: India

PostPosted: Thu Sep 11, 2008 4:42 pm
Reply with quote

Hi All,

Thanks for all the suggestions.I'm planning to delete the file from remote side.

Mbabu,

Cud you please eleborate on passive connection,locsite EPSV etc..Where it should be used..In the FTP step there is no locsite parameter.

How a stable server connection can beensured..What are the differnet scenarios of server connection failure?
Back to top
View user's profile Send private message
cma rajith

New User


Joined: 28 May 2008
Posts: 30
Location: India

PostPosted: Mon Sep 15, 2008 10:36 am
Reply with quote

Hi Robert,

I have tested deletion of empty file if created at the remote server.It's successful except when the exception code of FTP code is 648,then delete step fails with file not found reason.But at the sametime the remote file is getting created there!!

Please give me some informaton on exception code of this FTP..and how can I handle this.

Thanks ,
Ceema
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Sep 15, 2008 5:07 pm
Reply with quote

I'm not sure what a 648 is ... the specifications in RFC 959, which provide the FTP reply codes, stop at 559. Could you post the exact message in context to see what it says in full?
Back to top
View user's profile Send private message
cma rajith

New User


Joined: 28 May 2008
Posts: 30
Location: India

PostPosted: Tue Sep 16, 2008 2:46 pm
Reply with quote

Hi Robert,

On a particular day FTP failed due to interruption to server connection
Std Return Code = 27425, Error Code = 00009

Then delete step got executted but that also failed saying No such file or folder Std Return Code = 13550, Error Code = 00002

But actually the remote side the file got created with 0kb size.

Following were the return codes
PROCSTEP RC EXCP
FTPCALM 2849 648
FTPDEL 1262 620
$10 FLUSH 0
$13 FLUSH 0

On other day when FTP failed with same reason(Std Return Code = 27425, Error Code = 00009),Delete step got executed fine,

Following were the return codes
PROCSTEP RC EXCP
FTPCALM 2849 654
FTPDEL 00 620
$10 FLUSH 0
$13 FLUSH 0

Both cases the error code and return code was same only difference was in exception code..

Can u see something catchy in this..

Thanks,
Ceema
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts RACF - Rebuild SETROPTS command which... All Other Mainframe Topics 3
Search our Forums:

Back to Top