SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

DI Studio Email notification - Message part of email

Reply
Occasional Contributor
Posts: 14

DI Studio Email notification - Message part of email

I have this piece of code and it work perfectly

  %if (&job_rc eq 4) %then

  %do;

     %global email2;  

     %global error_desc2;  

      proc sql noprint;

       create table error_detail2 as

        select strip(recipient) as recipient,

               strip(error_description) as error_description

       from RISK.ERROR_.........

        where jobflow = 'DM_LOAD' and

              subject = 'Schema Error';

      quit;

      proc sql noprint;

        select strip(recipient) as recipient,

               strip(error_description) as error_description

        into :email2, :error_desc2

        from error_detail2;

      quit;

    %macro etls_sendEmail(message=);

      %let email2=&email2;

      %let error_desc2=&error_desc2;

         filename sendMail email "&email2"  subject='Load_ALL..... - Job ........ --- Error'; 

     

         %local etls_syntaxcheck;

         %let etls_syntaxcheck = %sysfunc(getoption(syntaxcheck));

         options nosyntaxcheck;

     

         data _null_;

            file sendMail;

            dttm = put(datetime(),nldatm.);

            put dttm "&message.";

         run;

         options &etls_syntaxcheck;

    %mend etls_sendEmail;

     %etls_sendEmail

       (Message = &error_desc2);

  %end;

and the output (Message part of email) look like below

08Jul14:10:49:39 ------ Target table column name changed (Oracle or DI) - Error

But now it is changed and I should display something like this

Error Date Time: 08Jul14:10:49:39  - Target table column name changed (Oracle or DI) - Error

Technical Team to advise

log file path: sas/log/......

I know that I have to modify this piece of code and add (concatenate) macro variable value &error_desc2 to &message, but it doesn't work...

         data _null_;

            file sendMail;

            dttm = put(datetime(),nldatm.);

            put dttm "&message.";

         run

SAS Employee
Posts: 33

Re: DI Studio Email notification - Message part of email

Hi,

This is definitely an issue you will want to open a track with SAS Technical Support to help you resolve.

Regards,

Mike F.

Respected Advisor
Posts: 3,908

Re: DI Studio Email notification - Message part of email

This looks to me like a usage problem so not something where you should raise a SAS Tech Support track. The code you've posted looks very close to auto generated one as part of job Status Handling but as there are a few differences I assume it's a copy and actually user written code - so you can change it as you wish. Below suggestion under the assumption it's user written:

You define a macro "%etls_sendEmail" with a parameter "message"

    %macro etls_sendEmail(message=);

        ......

        data _null_;

            file sendMail;

            dttm = put(datetime(),nldatm.);

            put dttm "&message.";

        run;

        ......

    %mend etls_sendEmail;

You call macro "%etls_sendEmail" and pass value "&error_desc2" to the parameter. That is the value which gets written as email body.

    %etls_sendEmail

      (Message = &error_desc2);

You could change the code to something like:

    %macro etls_sendEmail(line1=,line2=,line3=);

        ......

        data _null_;

            file sendMail;

            dttm = put(datetime(),nldatm.);

            put "Error Date Time: " dttm "&line1.";

            put "&line2.";

            put "&line3.";

        run;

        ......

    %mend etls_sendEmail;

    %etls_sendEmail

      (line1= &error_desc2,

        line2=Technical Team to advise,

        line3=log file path: <some macro var to define containing the path and log name>

      )

Ask a Question
Discussion stats
  • 2 replies
  • 494 views
  • 1 like
  • 3 in conversation