Append date to FTP file name
85 pts.
0
Q:
Append date to FTP file name
I want to append the date to the file name I am putting on the pc. I am using a cl batch program to process the files on a daily basis. The files are identified in a member in a source file. (PUT ftpdbf/filea filea102408.txt). The files from the 400 are created with a cpysplf command in various cl pgms during the day. I need to ftp them to the same folder on a daily basis. I'm not sure how I can do this. Does anyone have a sample of anything like this?
ASKED: Oct 25 2008  6:04 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
865 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
Not sure if I understood it correctly but here is a suggestion:

Implement in your CL the commands

DCL VAR(&NAME) TYPE(*CHAR) LEN(14)
DCL VAR(&DATE) TYPE(*CHAR) LEN(13)
DCL VAR(&RENAME) TYPE(*CHAR) LEN(10)

RTVMBRD FILE(SRCLIB/SRCFILE) MBR(&MBRNAME) CRTDATE(&DATE)
CHGVAR VAR(&NAME) VALUE('F' *TCAT &DATE)
CRTDTAARA DTAARA(QTEMP/NAME) TYPE(*CHAR) LEN(14)
CHGDTAARA DTAARA(QTEMP/NAME) VALUE(&NAME)
CHGDTAARA DTAARA(QTEMP/NAME (3 1)) VALUE('F')
RTVDTAARA DTAARA(QTEMP/NAME (3 9)) RTNVAR(&RENAME)

After that you are allowed to determine ow you will work with the file name (F+date+time). You can write an RPG to build the FTP input command receiving &RENAME as the variable name, or you can rename the file member using RNMM command, or you can use CPYTOIMPF to convert the file in a stream file with the &RENAME variable and them FTP the file.

Hope it can help a little bit.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
If the folder is Located in QDLS you have to know that the Name of the document is limited to 8 characters and a 3 character extension.
Peter.
Last Answered: Aug 28 2009  10:36 AM GMT by Pdraebel   865 pts.
Latest Contributors: Brunocl   215 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Graybeard52   2405 pts.  |   Aug 30 2009  11:56AM GMT

I actually do someything like this, because I have PC files that come in with the date in the file name. I have a RPG program that reads the FTP source file, plugs in date, the runs the FTP from the modified source statements.

 

Satsho   1235 pts.  |   Aug 31 2009  3:36PM GMT

I use a RPG program to do the same stuff - This is what I do and you can append the timestamp value depending on what you need.

@filename = ‘DA25R’ + %Subst(%Char(%Timestamp:*ISO0):3:4);

 
0