Date: Fri, 27 Oct 2006 07:47:21 -0700
Reply-To: Bharath.SManiam@GMAIL.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Bharath.SManiam@GMAIL.COM
Organization: http://groups.google.com
Subject: SAS EMAIL with and without Attachments
Content-Type: text/plain; charset="iso-8859-1"
Hi,
I have a SAS program which was working good until last month. The error
it shows is that the ATTACH option in the program is having invalid
value.
What I came to know was that there was a recent upgrade to the SAS
system from 8.2 to 9.1 i guess. What i wanted to know about is whether
it is possible to validate and send EMAIL from the single SAS program
with or without the attachments.
BTW the ATTACH value that I am specifying is a symbolic variable. It
was working fine with that format a month ago. now it is not. I tried
putting a IF- THEN logic to split the statement "FILE MAILTHIS &TO &CC
SUBJECT="SUBJECT" TYPE="&TYPE" ATTACH=(&ATTACH1 &ATTACH2...&ATTACH9)"
into two parts. One with the ATTACH option and the other without ATTACH
option.
Now after this I executed the pgm and it gave me an error saying the
INVALID value for ATTACH option. hence I specified a DUMMY file and
tried to execute it again.
Now the issue I was facing with this is that when i execute the
program, it sends mail twice. Onw with attachment and one without
attachment.
What i wanted to know here is whether this is happening with respect to
some software upgrade that has been done in the recent past or am I
missing something here to for the functionality.
Goal of my requirement is to make email flow from the single SAS
program with or without the Attachments.
I have attached the SAS LOG for the abend below.
ABEND when no ATTACH option was specified:
--------------------------------------------------------------------
139
140 FILENAME MAILTHIS EMAIL
SYMBOLGEN: Macro variable FROM resolves to ADEMAIL@XXX.COM
140 ! EMAILID="&FROM";
141 DATA _NULL_;
SYMBOLGEN: Macro variable SENDIT resolves to Y
142 IF "&SENDIT" = 'N' THEN STOP;
143 FILE MAILTHIS &TO &CC SUBJECT="&SUBJECT" TYPE="&TYPE"
SYMBOLGEN: Macro variable TO resolves to TO=( "BSUBRAM2@XXX.COM")
SYMBOLGEN: Macro variable CC resolves to
SYMBOLGEN: Macro variable SUBJECT resolves to Files are ready
SYMBOLGEN: Macro variable TYPE resolves to text/html
SYMBOLGEN: Macro variable ATTACH1 resolves to
SYMBOLGEN: Macro variable ATTACH2 resolves to
SYMBOLGEN: Macro variable ATTACH3 resolves to
SYMBOLGEN: Macro variable ATTACH4 resolves to
144 ATTACH=(&ATTACH1 &ATTACH2 &ATTACH3 &ATTACH4
&ATTACH5
SYMBOLGEN: Macro variable ATTACH5 resolves to
SYMBOLGEN: Macro variable ATTACH6 resolves to
SYMBOLGEN: Macro variable ATTACH7 resolves to
SYMBOLGEN: Macro variable ATTACH8 resolves to
SYMBOLGEN: Macro variable ATTACH9 resolves to
145 &ATTACH6 &ATTACH7 &ATTACH8 &ATTACH9);
145 &ATTACH6 &ATTACH7 &ATTACH8 &ATTACH9);
_
_
_
24
24
24
ERROR 24-2: Invalid value for the ATTACH option.
ERROR 24-2: Invalid value for the ATTACH option.
ERROR 24-2: Invalid value for the ATTACH option.
146 INFILE L793I;
147 INPUT @01 PARMID $CHAR04.
148 @01 RECORD $CHAR80.
149 ;
150 IF PARMID = '*P> ' THEN DELETE;
151 PUT @01 RECORD $CHAR80.;
NOTE: The SAS System stopped processing this step because of errors.
SAS LOG with the IF-THEN Split logic:
--------------------------------------------------------
142 FILENAME MAILTHIS EMAIL
SYMBOLGEN: Macro variable FROM resolves to ADEMAIL@XXX.COM
142 ! EMAILID="&FROM";
143 DATA _NULL_;
SYMBOLGEN: Macro variable SENDIT resolves to Y
144 IF "&SENDIT" = 'N' THEN STOP;
SYMBOLGEN: Macro variable ATCHMT resolves to N
145 IF "&ATCHMT" = 'Y' THEN STOP;
146
SYMBOLGEN: Macro variable ATCHMT resolves to N
147 IF "&ATCHMT" = 'N' THEN DO;
148 FILE MAILTHIS &TO &CC SUBJECT="&SUBJECT"
TYPE="&TYPE";
SYMBOLGEN: Macro variable TO resolves to TO=( "BSUBRAM2@XXX.COM")
SYMBOLGEN: Macro variable CC resolves to
SYMBOLGEN: Macro variable SUBJECT resolves to Files are ready
SYMBOLGEN: Macro variable TYPE resolves to text/html
149 SEND = "&SENDIT";
SYMBOLGEN: Macro variable SENDIT resolves to Y
150 SEND = 'N';
151 CALL SYMPUT('SENDIT', SEND);
152 END;
153
154 INFILE L793I;
155 INPUT @01 PARMID $CHAR04.
156 @01 RECORD $CHAR80.
157 ;
158 IF PARMID = '*P> ' THEN DELETE;
159 PUT @01 RECORD $CHAR80.;
160
NOTE: The file MAILTHIS is:
E-Mail Access Device
NOTE: The infile L793I is:
Dsname=SYS06300.T091308.RA000.TS432F8J.TEMP71.H01,
Unit=3390,Volume=SR2043,Disp=SHR,Blksize=27920,
Lrecl=80,Recfm=FB
Message sent
To: "BSUBRAM2@XXX.COM"
Cc:
Bcc:
Subject: Files are ready
Attachments:
NOTE: 26 records were written to the file MAILTHIS.
The minimum record length was 80.
The maximum record length was 80.
NOTE: 31 records were read from the infile L793I.
NOTE: The DATA statement used the following resources:
161 DATA _NULL_;
SYMBOLGEN: Macro variable SENDIT resolves to N
162 IF "&SENDIT" = 'N' THEN STOP;
163
SYMBOLGEN: Macro variable ATCHMT resolves to N
164 IF "&ATCHMT" = 'Y' THEN DO;
165 FILE MAILTHIS &TO &CC SUBJECT="&SUBJECT"
TYPE="&TYPE"
SYMBOLGEN: Macro variable TO resolves to TO=( "BSUBRAM2@XXX.COM")
SYMBOLGEN: Macro variable CC resolves to
SYMBOLGEN: Macro variable SUBJECT resolves to Files are ready
SYMBOLGEN: Macro variable TYPE resolves to text/html
SYMBOLGEN: Macro variable ATTACH1 resolves to 'USERID.DUMMY'
166 ATTACH=(&ATTACH1);
167 END;
168
169 INFILE L793I;
170 INPUT @01 PARMID $CHAR04.
171 @01 RECORD $CHAR80.
172 ;
173 IF PARMID = '*P> ' THEN DELETE;
174 PUT @01 RECORD $CHAR80.;
175
176
NOTE: The file MAILTHIS is:
E-Mail Access Device
NOTE: The infile L793I is:
Dsname=SYS06300.T091308.RA000.TS432F8J.TEMP71.H01,
Message sent
To: "BSUBRAM2@XXX.COM"
Cc:
Bcc:
Subject: Files are ready
Attachments: ( 'USERID.DUMMY' )
NOTE: 0 records were written to the file MAILTHIS.
NOTE: 0 records were read from the infile L793I.
Recent SAS information:
==================
NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) 9.1 (TS1M3)
Licensed to THE TRAVELERS INDEMNITY CO, Site 0042508001.
NOTE: This session is executing on the z/OS V01R06M00 platform.
NOTE: SAS 9.1.3 Service Pack 3
Welcome to SAS 9.1.3 SP3
Reloaded April 2006
SSS AAA SSS 999 1 3333
S S A A S S 9 9 1 1
3
S A S 9 9 1
3
S A S 9 9 1
3
S AAAA S 9999 1 3333
S A A S 9 1
3
S S A A S S 9 1
3
S S A A S S 9 0 1 0
3
SSS AAAAA SSS 99 0 111 0 3333