Append date to FTP file name

95 pts.
Tags:
AS/400 FTP
CL
CL batch program
CLP
CPYSPLF
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?

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • graybeard52
    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.
    3,115 pointsBadges:
    report
  • Satsho
    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);
    1,245 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following