Adding date to the filename of an emailed file
Posted: Tue Sep 16, 2008 9:02 pm
I've searched thru similar "adding date to file" posts both on here and the expert forums. I haven't seen my same situation though. I have existing code that emails a dataset. It sends the dataset as a file. I have been able to use the &DATE to add the date to the email subject line. Is there a way I could easily do this to the FILENAME as well without adding extra steps? I've tried adding &DATE as well as several other system variables. I also tried putting the filename within quotes '%date-report.txt as well as parenthesis and quoates ('&date-report.txt') with no luck. Is it possible to do this within the EMAILFLE line itself or is additional code needed?
//TEST EXEC PGM=IKJEFT1B,COND=(0,NE)
//SYSEXEC DD DSN=TEST.LIB,DISP=SHR
//SYSPRINT DD SYSOUT=(,)
//SYSTSPRT DD SYSOUT=(,)
//EMAILFLE DD DSN=TEST.DATASET(+0),
// DISP=SHR
//EMAILMSG DD *
/*
//SYSTSIN DD *
%XMITIP ( 'TEST'<TEST@.com>) -
FROM 'TEST'<TEST@TEST.COM> -
REPLYTO 'none'<asdfadf@asdf.com> -
FILEDD EMAILFLE -
FILENAME REPORT.TXT -
FORMAT XLS -
MSGDD EMAILMSG -
SUBJECT 'REPORT &DATE'
//*
//SYSEXEC DD DSN=TEST.LIB,DISP=SHR
//SYSPRINT DD SYSOUT=(,)
//SYSTSPRT DD SYSOUT=(,)
//EMAILFLE DD DSN=TEST.DATASET(+0),
// DISP=SHR
//EMAILMSG DD *
/*
//SYSTSIN DD *
%XMITIP ( 'TEST'<TEST@.com>) -
FROM 'TEST'<TEST@TEST.COM> -
REPLYTO 'none'<asdfadf@asdf.com> -
FILEDD EMAILFLE -
FILENAME REPORT.TXT -
FORMAT XLS -
MSGDD EMAILMSG -
SUBJECT 'REPORT &DATE'
//*