Page 1 of 1

Adding date to the filename of an emailed file

PostPosted: Tue Sep 16, 2008 9:02 pm
by D9988
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' 
//*                                                       

Re: Adding date to the filename of an emailed file

PostPosted: Wed Sep 17, 2008 1:28 am
by dick scherrer
Hello,

Is it possible to do this within the EMAILFLE line itself or is additional code needed?
You will need to add something. Keep in mind that no "node" of the dataset name may begin with a number.

Re: Adding date to the filename of an emailed file

PostPosted: Wed Sep 17, 2008 2:22 am
by MrSpock
I believe that you need to add steps as Dick has pointed out. This previous topic seems to closely match your situation.