Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
PUT and Then rename to add date at the end of a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: PUT and Then rename to add date at the end of a file
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: 1703
Location: Australia

PostPosted: Wed Sep 07, 2011 11:44 am    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10373
Location: italy

PostPosted: Wed Sep 07, 2011 12:45 pm    Post subject: Reply to: PUT and Then rename to add date at the end of a fi
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: 8195
Location: East Dubuque, Illinois, USA

PostPosted: Wed Sep 07, 2011 4:29 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Sep 08, 2011 3:46 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us