Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading data from PS file and send it as EMAIL body - SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
View previous topic :: :: View next topic  
Author Message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Fri Sep 23, 2016 12:51 pm    Post subject: Reading data from PS file and send it as EMAIL body - SAS
Reply with quote

Hello,

I am trying the read the data from the file IN1 and want to put it as it is in the email body and email it via SAS. I am using the JCL below but I am not getting the email body data in the same format, However i am getting the email.


Code:
//STEP1    EXEC SAS                                                 
//IN1      DD *                                                     
    ###############################################################
    THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY:    ##
    ###########################################                  ##
    ########################################### RAJAT BAGGA      ##
    ###########################################                  ##
    ###############################################################
/*                                                                 
//SYSIN    DD *                                                     
 FILENAME MAIL EMAIL                                               
     FROM = "BATCH MILESTONE REPORT <RAJAT.BAGGA@EMAIL.COM>"       
       TO = "RAJAT.X.BAGGA@EMAIL.COM"                             
  SUBJECT = "TEST EMAIL FROM SAS"                                   
  CONTENT_TYPE = "TEXT/HTML"                                       
//         DD *                                                     
    IMPORTANCE = "HIGH"                                             
//         DD *                                                     
;                                                                   
 DATA MLREP; INFILE IN1;                                           
  INPUT @1 LINE_DATA $CHAR80.;                                     
                                                                   
 RUN;                                                               
                                                                   
 DATA _NULL_;                                                       
  FILE MAIL;                                                       
  INFILE IN1;                                                       
  INPUT;                                                           
  PUT _INFILE_;                                                     
 RUN;                                                               
                                                                   
/*                                                                 


Present output (email body)
Code:

############################################################### THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY: ## ########################################### ## ########################################### RAJAT BAGGA ## ########################################### ## ###############################################################



Expected output should as in the instream :-


Code:
    ############################################################### 
    THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY:    ## 
    ###########################################                  ## 
    ########################################### RAJAT BAGGA      ## 
    ###########################################                  ## 
    ############################################################### 



Please assist.

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

Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Thu Oct 06, 2016 1:51 am    Post subject:
Reply with quote

Change to
Code:
CONTENT_TYPE = "TEXT/PLAIN"
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Fri Oct 07, 2016 11:11 am    Post subject:
Reply with quote

Hello Rohit,

thanks, I tried this already but the output in this case will be :-

Code:
    ###############################################################             
    THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY: ##             
    ###########################################     ##             
    ########################################### RAJAT BAGGA  ##             
    ###########################################     ##             
    ###############################################################             


I want he expected output to be :-
Code:

    ###############################################################
    THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY:    ##
    ###########################################                  ##
    ########################################### RAJAT BAGGA      ##
    ###########################################                  ##
    ###############################################################


Thanks Rajat
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Oct 07, 2016 5:15 pm    Post subject:
Reply with quote

I hope you do realize that the expected output you want is not possible, at least not in the way you want it to be. The font for the email is controlled by the email client, NOT by the mainframe. If you change your email font to Courier then you'll get fixed-width characters; the default (as you have seen) is proportional-width characters. This is not an option under mainframe control - it is ENTIRELY the email client.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Sat Oct 08, 2016 3:49 am    Post subject:
Reply with quote

Try this gimmicky code
Code:
//STEP1    EXEC SAS                                           
//IN1      DD *                                               
Hey I just met you                                             
And this is crazy                                             
But here s my number                                           
So call me maybe                                               
It s hard to look right at you baby                           
But here s my number                                           
So call me maybe                                               
/*                                                             
//SYSIN    DD   *                                             
FILENAME EMAIL EMAIL                                           
 FROM = ("vasanthz@trolland.com")                   
 TO = ("vasanthz@trolland.com")                     
 REPLYTO=("vasanthz@trolland.com")                 
 SUBJECT="SOME SAMPLE TEST REPORT"                             
 CONTENT_TYPE = "text/html"                                   
//         DD *                                               
     IMPORTANCE = "HIGH"                                       
//         DD *                                               
;                                                             
                                                               
data _null_;                                                   
file email;                                                   
infile in1 end=last;                                           
INPUT;                                                         
IF _N_ = 1 THEN DO;                                           
  put '<html>';                                               
  put '<head>';                                               
  put '<meta content="text/html; charset=ISO-8859-1"           
       http-equiv="content-type">';                           
  put '</head>';                                               
  put '<body>';                                               
  put '<b>';                                                   
  put '<span style="font-size: 12pt;';                         
  put 'font-family: &quot;Courier&quot;,&quot;serif&quot;;">';
END;                                                           
  put _INFILE_;                                               
  put '<br>';                                                 
IF LAST THEN DO;                                               
  put '</body>';     
  put '</html>';     
END;                 
run;                 
/*                   
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Sun Oct 09, 2016 10:48 am    Post subject:
Reply with quote

http://ibmmainframes.com/viewtopic.php?t=63584&highlight=outlook

Here is a another code which does what you want. The logic is the same.

Cheers,
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Mon Oct 10, 2016 4:10 am    Post subject:
Reply with quote

vasanthz wrote:
Try this gimmicky code
Code:
//STEP1    EXEC SAS                                           
//IN1      DD *                                               
Hey I just met you                                             
And this is crazy                                             
But here s my number                                           
So call me maybe                                               
It s hard to look right at you baby                           
But here s my number                                           
So call me maybe                                               
/*                                                             
//SYSIN    DD   *                                             
FILENAME EMAIL EMAIL                                           
 FROM = ("vasanthz@trolland.com")                   
 TO = ("vasanthz@trolland.com")                     
 REPLYTO=("vasanthz@trolland.com")                 
 SUBJECT="SOME SAMPLE TEST REPORT"                             
 CONTENT_TYPE = "text/html"                                   
//         DD *                                               
     IMPORTANCE = "HIGH"                                       
//         DD *                                               
;                                                             
                                                               
data _null_;                                                   
file email;                                                   
infile in1 end=last;                                           
INPUT;                                                         
IF _N_ = 1 THEN DO;                                           
  put '<html>';                                               
  put '<head>';                                               
  put '<meta content="text/html; charset=ISO-8859-1"           
       http-equiv="content-type">';                           
  put '</head>';                                               
  put '<body>';                                               
  put '<b>';                                                   
  put '<span style="font-size: 12pt;';                         
  put 'font-family: &quot;Courier&quot;,&quot;serif&quot;;">';
END;                                                           
  put _INFILE_;                                               
  put '<br>';                                                 
IF LAST THEN DO;                                               
  put '</body>';     
  put '</html>';     
END;                 
run;                 
/*                   



Hello vasanthz, Thanks for the code, infact i tried a similar code already and it does changes the font size to 12pt and font to courier however the spaces are lost in the transition. Meaning i still get the same output even though the font is changed.. I don't know if it is possible to retain the spaces, it is just squeezing up all the spaces to 1 space.

Regards, Rajat

Output with your code:-

Code:
###############################################################
THE BATCH MILESTONES HAVE BEEN PROUDLY BROUGHT TO YOU BY: ##
########################################### ##
########################################### RAJAT BAGGA ##
########################################### ##
###############################################################


Regards, Rajat
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Oct 10, 2016 11:01 pm    Post subject:
Reply with quote

Why do you need SAS desperately anyways to send emails? There are simpler other ways to do it.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon Oct 10, 2016 11:09 pm    Post subject:
Reply with quote

Well,certainly SAS is easier than most of them. It is flexible, powerful.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Oct 10, 2016 11:13 pm    Post subject:
Reply with quote

IEBGENER, This is mostly used everywhere based on my experience and forum discussion which is very easy, less coding, no need to know SAS and powerfull.
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon Oct 10, 2016 11:13 pm    Post subject:
Reply with quote

This one works fine. Made changes to font.
Code:
//STEP1    EXEC SAS                                           
 //IN1      DD *                                               
 Hey I just met you                                             
 And this is crazy                                             
 But here s my number                                           
 So call me maybe                                               
 It s hard to look right at you baby                           
 But here s my number                                           
 So call me maybe                                               
 /*                                                             
 //SYSIN    DD   *                                             
 FILENAME EMAIL EMAIL                                           
  FROM = ("vasanthz@trolland.com")                   
  TO = ("vasanthz@trolland.com")                     
  REPLYTO=("vasanthz@trolland.com")                 
  SUBJECT="SOME SAMPLE TEST REPORT"                             
  CONTENT_TYPE = "text/html"                                   
 //         DD *                                               
      IMPORTANCE = "HIGH"                                       
 //         DD *                                               
 ;                                                             
data _null_;                                 
file email;                                   
infile in1 end=last;                         
INPUT;                                       
IF _N_ = 1 THEN DO;                           
  put '<html>';                               
  put '<body>';                               
  put '<pre style="font: monospace">';       
END;                                         
  put _INFILE_;                                                             
IF LAST THEN DO;                             
  put '</pre>';                               
  put '</body>';                             
  put '</html>';                             
END;                                         
run;                           
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Mon Oct 10, 2016 11:16 pm    Post subject:
Reply with quote

Quote:
IEBGENER, This is mostly used everywhere based on my forum experience and forum discussion which is very easy, less coding, no need to know SAS and powerfull.

Guess it is just personal preference. Or maybe I am biased by my joy in SAS programming.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Mon Oct 10, 2016 11:21 pm    Post subject:
Reply with quote

Yeah, could be.
I hope what you suggested works or TS better be switching over to something else than wasting time around SAS programming unless force to do only by SAS and that's came someone called LEAD. icon_smile.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Mon Oct 10, 2016 11:43 pm    Post subject: Reply to: Reading data from PS file and send it as EMAIL body - SAS
Reply with quote

I wonder why everybody is wasting time on a stupid cosmetics issue
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1445
Location: Azeroth

PostPosted: Tue Oct 11, 2016 12:12 am    Post subject:
Reply with quote

The question isn't why but why not. Finer touches add value.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Tue Oct 11, 2016 12:44 am    Post subject: Re: Reply to: Reading data from PS file and send it as EMAIL body - SAS
Reply with quote

enrico-sorichetti wrote:
I wonder why everybody is wasting time on a stupid cosmetics issue

In modern LUW programming, whether the application fails is irrelevant; what counts is whether it fails prettily. We're just trying to get the legacy systems down to that standard icon_razz.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Tue Oct 11, 2016 12:56 am    Post subject:
Reply with quote

Quote:
what counts is whether it fails prettily
Yeah? I've been dealing with a Java dump trace in a z/OS MF function -- and that is NOT pretty no matter how much paint you slap on that pig! icon_biggrin.gif
Back to top
View user's profile Send private message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Wed Oct 12, 2016 6:00 am    Post subject:
Reply with quote

vasanthz wrote:
This one works fine. Made changes to font.
Code:
//STEP1    EXEC SAS                                           
 //IN1      DD *                                               
 Hey I just met you                                             
 And this is crazy                                             
 But here s my number                                           
 So call me maybe                                               
 It s hard to look right at you baby                           
 But here s my number                                           
 So call me maybe                                               
 /*                                                             
 //SYSIN    DD   *                                             
 FILENAME EMAIL EMAIL                                           
  FROM = ("vasanthz@trolland.com")                   
  TO = ("vasanthz@trolland.com")                     
  REPLYTO=("vasanthz@trolland.com")                 
  SUBJECT="SOME SAMPLE TEST REPORT"                             
  CONTENT_TYPE = "text/html"                                   
 //         DD *                                               
      IMPORTANCE = "HIGH"                                       
 //         DD *                                               
 ;                                                             
data _null_;                                 
file email;                                   
infile in1 end=last;                         
INPUT;                                       
IF _N_ = 1 THEN DO;                           
  put '<html>';                               
  put '<body>';                               
  put '<pre style="font: monospace">';       
END;                                         
  put _INFILE_;                                                             
IF LAST THEN DO;                             
  put '</pre>';                               
  put '</body>';                             
  put '</html>';                             
END;                                         
run;                           


Thanks a LOT, This works perfectly well, and Yeah this is off course the test data, I have lot of other stuff which needed to be displayed one below the other in the body of the email so the alignment of data was really very important.

Now its looking all good.


Coming onto selection of SAS, Well i am reading the data and depending on the data/stat I want to email I am marking the importance of the email as IMPORTANCE = "HIGH" !! , this is not possible to achieve in the normal SMTP/IEBGENER scenario.


Thanks Again,
Regards,
Rajat
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Oct 12, 2016 7:03 am    Post subject:
Reply with quote

How about IMPORTANCE : HIGH for IEBGENER?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us