View previous topic :: View next topic
|
Author |
Message |
kranthikumarb
Active User
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
|
|
|
|
Hi All,
I have FTPd a file on to a server and I am trying to change the name of the file FTPd to append year at the end. it is not working.Here is my code and the error message. Can someone help me pls.
Code: |
//INPUT DD *
<server name?
<id>
<Password>
PWD
PUT 'XYT.XY0097.ZXY97S10.XY97OUT' TEST.TXT
REN TEST.TXT TEST%DATE:~10,4%.TXT
QUIT
|
Code: |
Here is the error message.
EZA1736I PUT 'XYT.XY0097.ZXY97S10.XY97OUT' TEST.TXT
EZA1701I >>> SITE FIXrecfm 305 LRECL=305 RECFM=FB BLKSIZE=27755
500 'SITE FIXrecfm 305 LRECL=305 RECFM=FB BLKSIZE=27755': command not understood
EZA1701I >>> PORT 172,19,150,140,247,248
200 PORT command successful.
EZA1701I >>> STOR TEST.TXT
150 Opening ASCII mode data connection for TEST.TXT.
226 Transfer complete.
EZA1617I 1326547 bytes transferred in 1.160 seconds. Transfer rate 1143.57 Kbyt
EZA1460I Command:
EZA1736I RENAME TEST.TXT TEST%DATE:~10,4%.TXT
EZA1701I >>> RNFR TEST.TXT
350 File exists, ready for destination name
EZA1701I >>> RNTO TEST%DATE:~10,4%.TXT
550 TEST%DATE:~10,4%.TXT: The system cannot find the path specified.
EZA1735I Std Return Code = 31550, Error Code = 00002
EZA1701I >>> QUIT
|
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
if you hard code this statement
Code: |
REN TEST.TXT TEST%DATE:~10,4%.TXT
|
does it work? ie. resolve the values yourself.
I can't claim to be an expert in FTP, can FTP resolve %DATE ?
Also why do you need a rename, why can't the PUT statement create the correct file name?
Gerry |
|
Back to top |
|
|
kranthikumarb
Active User
Joined: 02 Jan 2009 Posts: 115 Location: Hyderabad
|
|
|
|
Hello Gerry,
Thanks for your prompt response. If the put statement can do it, I would be more than happy.
The reason why I tried it in rename is, it is working from the command prompt (dos). I tried to rename a file on my desktop with the command i gave above. It worked. But it is not working if i use in FTP jcl.
Please let me know if the put statement can itself do the rename to the current date.
I tried this, But it didn't work out. The FTPd file name is now TEST%DATE
PUT 'XYT.XY0097.ZXY97S10.XY97OUT' TEST%DATE:~10,4%.TXT
I tried to list the files it after the PUT, it didn't transfer the data properly. Showing zero bytes
EZA1701I >>> LIST ABCD*
150 Opening ASCII mode data connection for /bin/ls.
EZA2284I 09-07-11 01:28AM 0 ABCD%DATE |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
why do You think that FTP would/should/could understand/interpret/resolve TEST%DATE:~10,4%.TXT |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
FTP is a file transfer protocol. It has NO scripting capability AT ALL. Therefore, you will have to find a way to generate the file name in the format you want and pass it as part of the FTP commands to the FTP step. You can generate the FTP commands via SAS, REXX, a progrram written in the language of your choice, and most likely even SORT. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
just to add to Robert's reply, if the job is running thru a scheduling tool,
you can use some of the auto edit facilities available to the scheduling tool to resolve/build the date.
Gerry |
|
Back to top |
|
|
|