IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Changing the name of the email attachment dynamically.


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Wed Aug 20, 2008 12:44 pm
Reply with quote

My task is to send an email from mainframe along with an attached file in TXT format in a daily job. The requirement is such that the file name needs to be changed everyday; the name of the file is
CURRDATE_ CustomerData_SEQNUM. In this file name the value of CURRDATE and SEQNUM are coming from 2 different PDS members.
I have created a procedure NEWMAIL3 which is called from the JCL “XFIR05.TEST.MAIL(NEWMAIL2)” given below. When I submit this JCL I can send the email successfully along with the TXT file attached (the maxcc is equal to 0).

The problem is that I am not able to change the file name dynamically. The file attached in the mail is named as “&CURRDATE..CustomerData.&SEQNUM”; whereas the expected name is “30072008.CustomerData.00001”.

When I see the joblog I can see the variables are passed to the procedure along with the correct values (PGM=IKJEFT01,PARM='CURRDATE=30072008,SEQNUM=00001').

Can anyone please help me out with this problem?

JCL - XFIR05.TEST.MAIL(NEWMAIL2)
Code:
//XFIR05AJ JOB CLASS=I,MSGCLASS=X,REGION=0M,NOTIFY=&SYSUID   
//JOBLIB   DD DSN=ALC.PROD.BLOAD,DISP=SHR                   
//         DD   DSN=TEL.PROD.LOADLIB.BATCH,DISP=SHR         
//PROCLIB  JCLLIB ORDER=(TEL.TEST.DATA.FEED.FILE.PARMS)     
//STEP0001 INCLUDE MEMBER=CURRDATE                           
//STEP0002 INCLUDE MEMBER=SEQNUM                             
//STEP0003 EXEC NEWMAIL3,                                   
//           CURRDATE=&CURRDATE,                             
//           SEQNUM=&SEQNUM                                 
//*



VALUE OF CURRDATE - TEL.TEST.DATA.FEED.FILE.PARMS(CURRDATE)
Code:
// SET CURRDATE=30072008


VALUE OF SEQNUM - TEL.TEST.DATA.FEED.FILE.PARMS(SEQNUM)
Code:
// SET SEQNUM=00001


PROC - TEL.TEST.DATA.FEED.FILE.PARMS(NEWMAIL3)
Code:
//NEWMAIL3 PROC                                                       
//PRST001  EXEC PGM=IKJEFT01,PARM='CURRDATE=&CURRDATE,SEQNUM=&SEQNUM'
//SYSPROC   DD DISP=SHR,DSN=SYS3.SPF.PROCS                           
//          DD DISP=SHR,DSN=ALC.PROD.PARMLIB                         
//ISPPROF   DD UNIT=SYSDA,                                           
//             SPACE=(TRK,(2,1,2),RLSE),                             
//             LRECL=80,BLKSIZE=0,RECFM=FB,DSORG=PO                   
//ISPLOG    DD UNIT=SYSDA,                                           
//             SPACE=(TRK,(2,1,2),RLSE),                             
//             LRECL=80,BLKSIZE=0,RECFM=FB,DSORG=PO                   
//*********                                                           
//TEXT      DD DISP=SHR,DSN=TEL.TEST.DATA.FEED.MAIL(-1)               
//*********                                                           
//SYSTSPRT  DD SYSOUT=*                                               
//SYSPRINT  DD SYSOUT=*                                               
//SYSOUT    DD SYSOUT=*                                               
//SYSTSIN   DD DISP=SHR,DSN=XFIR05.TEST.MAIL(NEWPARM)                 
//*


EMAIL PARAMETERS - XFIR05.TEST.MAIL(NEWPARM)
Code:
 XMITIP (abc.def@xyz.com                      -
 Pqr.lmn@xyz.com)                         +   
 MSGDS 'xfir05.test.mail(DECLARE1)'       +   
 FORMAT TXT                               +   
 FROM hij.klm@xyz.com                     +   
 SUBJECT 'Mailing Data Feed File.'        +   
 IMPORTANCE NORMAL                        +   
 PRIORITY NORMAL                          +   
 FILEDD (TEXT)                            +   
 FILENAME (&CURRDATE..CustomerData.&SEQNUM)
Back to top
View user's profile Send private message
jsathishbabu84

New User


Joined: 07 Jun 2007
Posts: 22
Location: India

PostPosted: Wed Aug 20, 2008 5:17 pm
Reply with quote

Hi Shanu,

I dont think passing the Current date and Seqnum as parm would change the symbolics ( FILENAME (&CURRDATE..CustomerData.&SEQNUM)) in the control card XFIR05.TEST.MAIL(NEWPARM).

Instead u can create a flat file having all the contents of XFIR05.TEST.MAIL(NEWPARM) in the previous step which should have the symbolics replaced with the attachment name u wanted. This can be achieved via program or sort using symnames (not sure)

And then replace
//SYSTSIN DD DISP=SHR,DSN=XFIR05.TEST.MAIL(NEWPARM)
with the flat file created in the previous step.

Hope this helps. Experts correct me if i am wrong anywhere.

Regards,
SJ
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Aug 20, 2008 5:39 pm
Reply with quote

// SET CURRDATE=30072008
// SET SEQNUM=00001
FILENAME (&CURRDATE..CustomerData.&SEQNUM)

Would result in a file 30072008.CustomerData.00001 - Which is an invalid MVS dataset name.

IKJEFT01 will execute what it is told to execute, and I can see nothing in your SYSTSIN code to substitute any symbolics. Just putting the required values into the PARM statement does not mean that they will automatically be substitued.

As stated by jsathishbabu84 you would probably need a prior step to resolve the symbolics and then pass a temporary file to be used as SYSTSIN.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Aug 20, 2008 5:44 pm
Reply with quote

I'm looking at the XMITIP User Reference Guide page 27 where a table shows all of the Supported Symbolic Variables that are allowed for FILENAME, and I don't see either of the values you specified in the table.
Back to top
View user's profile Send private message
shanudarling
Warnings : 1

New User


Joined: 20 Dec 2006
Posts: 55
Location: noida

PostPosted: Thu Aug 21, 2008 9:22 pm
Reply with quote

Thanx.. had to write a new program which will create the NEWPARM. Now I am able to name the file dynamically.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Dynamically pass table name to a sele... DB2 2
No new posts changing defaults in db2 admin - Unlo... DB2 0
No new posts mail attachment with excel format All Other Mainframe Topics 2
No new posts REXX to send an email in Mainframe wi... CLIST & REXX 3
No new posts REXX to send an email in Mainframe CLIST & REXX 4
Search our Forums:

Back to Top