MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get the # of records to send an e-mail if there are records

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
tony2nd
Beginner


Joined: 18 Jun 2010
Posts: 10
Topics: 4

PostPosted: Wed Feb 23, 2011 11:55 am    Post subject: Get the # of records to send an e-mail if there are records Reply with quote

Hi there,

I have already found a solution but I don't think it is efficient. It's doing two passes to get the results.

What I need:
- see if the files are empty and set a RC to avoid sending an e-mail
- count the records
- prepare an e-mail with header, total of records, and trailer.

What I did:
Code:

//S1 EXEC PGM=ICETOOL                                     
//TOOLMSG DD SYSOUT=*                                     
//DFSMSG  DD SYSOUT=*                                     
//IN       DD  DISP=SHR,DSN=file1
//         DD  DISP=SHR,DSN=file2T         
//         DD  DISP=SHR,DSN=file3         
//OUT      DD  SYSOUT=*                                   
//TOOLIN  DD *                                             
COPY FROM(IN) TO(OUT) USING(CTL1)                         
COUNT FROM(IN) EMPTY RC4                                   
/*                                                         
//CTL1CNTL DD  *                                           
  SORT FIELDS=COPY                                         
  OUTFIL REMOVECC,NODETAIL,                               
   HEADER1=('Hello,',/,                                   
   'We have transmitted a file to your UAT system'),
   TRAILER2=('Number of records: ',COUNT=(M11,LENGTH=6),/),
   TRAILER1=('Tony2nd') 
/*                                 

The e-mail would be something like:
Hello,
We have transmitted a file to your UAT system

Number of records: 001720

Tony2nd

PS: Also I tried to add an extra line after the "Hello" with "2/" but it didn't work.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Wed Feb 23, 2011 12:25 pm    Post subject: Reply with quote

tony2nd,

Use the following DFSORT JCL which will set a return code of 4 when the files are empty and generate the email.

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD  DISP=SHR,DSN=file1
//         DD  DISP=SHR,DSN=file2T
//         DD  DISP=SHR,DSN=file3
//SORTOUT  DD DUMMY
//EMAIL    DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY,NULLOUT=RC4                                   
  OUTFIL FNAMES=EMAIL,REMOVECC,NODETAIL,                   
  HEADER1=('HELLO,',/,                                     
           'WE HAVE TRANSMITTED A FILE TO YOUR UAT SYSTEM'),
  TRAILER1=('NUMBER OF RECORDS: ',COUNT=(M11,LENGTH=6),/,   
            'TONY2ND')                                     
//*

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group