Page 1 of 1

FTP dataset with date and time appended.

Posted: Wed Jul 20, 2016 4:50 pm
by Sulabh Sinha
Hello All,

I have been trying to ftp a file from mainframe to windows. I need to target file name unique each time. I thought append the date and time to the file name, so that the file name generated each time is unique. To do this, have used the below JCL :

Code: Select all

//FTP001 EXEC PGM=FTP
//SYSPRINT DD SYSOUT=*
//INPUT DD *
ip address
user id
password
put 'Source_file' Target.file.YYMMDD.HHMMSS
quit. /*
//OUTPUT DD SYSOUT=*
 But it does not work. Can someone help me on this?

Re: FTP dataset with date and time appended.

Posted: Wed Jul 20, 2016 6:04 pm
by enrico-sorichetti
But it does not work. Can someone help me on this?
NOT with the info provided!

But it does not work is just a useless generic rant
tell us what REALLY happened and what You were expecting,
after that we will think about helping You.

Re: FTP dataset with date and time appended.

Posted: Wed Jul 20, 2016 6:15 pm
by Robert Sample
 But it does not work.
This is a TOTALLY useless statement to make.  Among other things, you could mean (and could have said to clarify for us):
- your FTP job is failing with JCL error before executing
- your FTP job is executing but one of the FTP sub-commands is failing
- your FTP job is executing but giving an error
- your FTP job is executing but the input data set has a problem
- your FTP job is executing but the output data set is not recognizable
- your FTP job is executing but the output data set has unrecognizable data
etc
etc
etc
As a wild guess, I would say that probably you have discovered that FTP does not substitute YYMMDD  and HHMMSS with the date and time.  And this is normal because FTP does not have any variables for date or time.  The usual way to resolve this is to build the FTP sub-commands in the language of your choice (PERL and Unix shell script are both common, but even COBOL can be used) in one job step, then the next job step executes FTP with the input being the data set you just created.