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

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


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 199
Location: india

PostPosted: Fri Sep 23, 2016 12:51 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Thu Oct 06, 2016 1:51 am
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: 199
Location: india

PostPosted: Fri Oct 07, 2016 11:11 am
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: 8700
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 07, 2016 5:15 pm
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: 1744
Location: Tirupur, India

PostPosted: Sat Oct 08, 2016 3:49 am
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: 1744
Location: Tirupur, India

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

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: 199
Location: india

PostPosted: Mon Oct 10, 2016 4:10 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Oct 10, 2016 11:01 pm
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: 1744
Location: Tirupur, India

PostPosted: Mon Oct 10, 2016 11:09 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Oct 10, 2016 11:13 pm
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: 1744
Location: Tirupur, India

PostPosted: Mon Oct 10, 2016 11:13 pm
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: 1744
Location: Tirupur, India

PostPosted: Mon Oct 10, 2016 11:16 pm
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Oct 10, 2016 11:21 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Mon Oct 10, 2016 11:43 pm
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: 1744
Location: Tirupur, India

PostPosted: Tue Oct 11, 2016 12:12 am
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: 1787
Location: Bloomington, IL

PostPosted: Tue Oct 11, 2016 12:44 am
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: 8700
Location: Dubuque, Iowa, USA

PostPosted: Tue Oct 11, 2016 12:56 am
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: 199
Location: india

PostPosted: Wed Oct 12, 2016 6:00 am
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

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Wed Oct 12, 2016 7:03 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts db2 vs static data COBOL Programming 1
No new posts External data queue (changes?) CLIST & REXX 0
No new posts Pull data using date difference betwe... DB2 6
No new posts fast data scrambling PL/I & Assembler 10
Search our Forums:

Back to Top