How to change name of file to include date in the name of the file

5 pts.
Tags:
FTP
JCL
Job Control Language
Mainframe
I want to FTP from mainframe to PC. We run the JCL to do that and this JOB should run every day. Is it possible to change the name of the file that I want to send to the PC everytime? For instance, I'd like to put the month/date/year in the file name. //********************************************************************** //* THIS STEP FTP THE REPORT * //********************************************************************** //NVBC31B EXEC FTP, // COND=(0,NE,NVBC31A.D) //SYSPRINT DD SYSOUT=* //OUTPUT DD SYSOUT=* //INPUT DD DSN=PTSO.FC500.NVLF01AA(NVM000AD),DISP=SHR // DD * CD PROMO_PAYMENT_BALANCING_REPORTS CD PCRCREATION PUT 'P1OPSBP.F9999.NVBF31AB' 'PCR CREATION REP.XLT' quit //* So in the above example file name ' PCR CREATION REP.XLT ' should be created as PCR CREATION REP MM-DD-YYYY.XLT.

Answer Wiki

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

Well, if you were to pull the FTP using the PC from the mainframe then you can get the DATE in DOS and strip it down or format it to meet your requirements like this:

@echo off

REM *****************************************************
REM **** These lines will get the current date and *****
REM **** time in this format yy-mm-dd and will *****
REM **** display only the last 2 digits of the *****
REM **** year. *****
REM *****************************************************

set year=%date:~12,2%

REM *****************************************************
REM **** To show the 4 digit year change the above ****
REM **** to be: year=%date:~10,4% ****
REM *****************************************************

set month=%date:~4,2%
set day=%date:~7,2%

set yymmdd=%date:~12,2%-%date:~4,2%-%date:~7,2%

REM echo %year%
REM echo %month%
REM echo %day%
REM echo %yymmdd%

REM ******************************************************
REM **** CAT out todays date to a text file for use ****
REM **** by the EXCLUDE part of the xcopy command ****
REM ******************************************************

echo ex%year%%month%%day% > ExcludeToday.txt

c:
cd\weblogs

Rem logs for ektron
%systemroot%\system32\xcopy \\192.168.25.25\IISLogs\ C:\Weblogs /C /D /Y /S /EXCLUDE:C:\ExcludeToday.txt

OR You can use this method below:
THIS ONE CHECKS the month and number of days in the month, etc…

@echo off

set yyyy=

set $tok=1-3
for /f “tokens=1 delims=.:/-, ” %%u in (‘date /t’) do set $d1=%%u
if “%$d1:~0,1%” GTR “9” set $tok=2-4
for /f “tokens=%$tok% delims=.:/-, ” %%u in (‘date /t’) do (
for /f “skip=1 tokens=2-4 delims=/-,().” %%x in (‘echo.^|date’) do (
set %%x=%%u
set %%y=%%v
set %%z=%%w
set $d1=
set $tok=))

if “%yyyy%”==”” set yyyy=%yy%
if /I %yyyy% LSS 100 set /A yyyy=2000 + 1%yyyy% – 100

set CurDate=%mm%/%dd%/%yyyy%

set dayCnt=%1

if “%dayCnt%”==”” set dayCnt=1

REM Substract your days here
set /A dd=1%dd% – 100 – %dayCnt%
set /A mm=1%mm% – 100

:CHKDAY

if /I %dd% GTR 0 goto DONE

set /A mm=%mm% – 1

if /I %mm% GTR 0 goto ADJUSTDAY

set /A mm=12
set /A yyyy=%yyyy% – 1

:ADJUSTDAY

if %mm%==1 goto SET31
if %mm%==2 goto LEAPCHK
if %mm%==3 goto SET31
if %mm%==4 goto SET30
if %mm%==5 goto SET31
if %mm%==6 goto SET30
if %mm%==7 goto SET31
if %mm%==8 goto SET31
if %mm%==9 goto SET30
if %mm%==10 goto SET31
if %mm%==11 goto SET30
REM ** Month 12 falls through

:SET31

set /A dd=31 + %dd%

goto CHKDAY

:SET30

set /A dd=30 + %dd%

goto CHKDAY

:LEAPCHK

set /A tt=%yyyy% %% 4

if not %tt%==0 goto SET28

set /A tt=%yyyy% %% 100

if not %tt%==0 goto SET29

set /A tt=%yyyy% %% 400

if %tt%==0 goto SET29

:SET28

set /A dd=28 + %dd%

goto CHKDAY

:SET29

set /A dd=29 + %dd%

goto CHKDAY

:DONE

if /I %mm% LSS 10 set mm=0%mm%
if /I %dd% LSS 10 set dd=0%dd%

echo Date %dayCnt% day(s) before %CurDate% is %mm%/%dd%/%yyyy%

c:
cd c:\Perl\Scripts\Logs\Exclude
perl C:\Perl\Scripts\Logs\Exclude\LogSplitterEXSeperate.pl c:\weblogs\ %yyyy%%mm%%dd% c:\weblogs\weblogs_processed\past\

Discuss This Question:  

 
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

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