Adding date to the filename of an emailed file



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Adding date to the filename of an emailed file

Postby D9988 » 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' 
//*                                                       
David
D9988
 
Posts: 34
Joined: Fri Nov 09, 2007 10:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Adding date to the filename of an emailed file

Postby dick scherrer » Wed Sep 17, 2008 1:28 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: Adding date to the filename of an emailed file

Postby MrSpock » Wed Sep 17, 2008 2:22 am

I believe that you need to add steps as Dick has pointed out. This previous topic seems to closely match your situation.
User avatar
MrSpock
Global moderator
 
Posts: 807
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post