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

PUT and Then rename to add date at the end of a file


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

Active User


Joined: 02 Jan 2009
Posts: 115
Location: Hyderabad

PostPosted: Wed Sep 07, 2011 11:01 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Sep 07, 2011 11:44 am
Reply with quote

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
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 115
Location: Hyderabad

PostPosted: Wed Sep 07, 2011 11:59 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Sep 07, 2011 12:45 pm
Reply with quote

why do You think that FTP would/should/could understand/interpret/resolve TEST%DATE:~10,4%.TXT
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 07, 2011 4:29 pm
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Sep 08, 2011 3:46 am
Reply with quote

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
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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
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
Search our Forums:

Back to Top