View previous topic :: View next topic |
Author |
Message |
Declan Beginner
Joined: 04 May 2005 Posts: 15 Topics: 8
|
Posted: Wed Jan 18, 2006 4:54 am Post subject: Sending email - SAS question |
|
|
Hi there,
I've found some very useful information in these forums on sending emails from the mainframe.
The company I work for will not allow us to send externally using REXX and SMTP, however I've found that using SAS will allow mails to be sent externally.
The file I want to send is 2004 bytes in length. The SAS I have used to send it is the following:
Code: |
//SAS2 EXEC SAS,
// OPTIONS='EMAILHOST=smtp.mycompany.com'
//STEPLIB DD
// DD DSN=XXXX.SASP.LIBRARY.NEW,DISP=SHR
FILENAME MYMAIL EMAIL ('DECLAN@MYCOMPANY.COM')
SUBJECT='YOUR PRINT OUTPUT'
FROM='COMPANY@MYCOMPANY.COM'
ATTACH=("THE.FILE.I.WANT.TO.ATTACH"
EXTENSION='dat'
CONTENT_TYPE="TEXT/PLAIN");
DATA _NULL_;
FILE MYMAIL;
PUT ' ';
PUT 'TEST';
RUN;
/*
|
The mail sends successfully - but when I open the attachment in Notepad, Wordpad and Internet Explorer - all 2004 bytes of data are spread across 3 lines.
Is there any way of changing the SAS so that all 2004 bytes are displayed on one line?
Many thanks in advance  |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Jan 18, 2006 5:05 am Post subject: |
|
|
Declan,
Click on FORMAT in notepad tab and unclick "word wrap" and you will just see 1 line of data.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Declan Beginner
Joined: 04 May 2005 Posts: 15 Topics: 8
|
Posted: Wed Jan 18, 2006 6:01 am Post subject: |
|
|
Hi Kolusu,
Thanks for your reply.
Unfortunately your suggestion does not work.
Is there any changes that can be made to the SAS so that when the recipient opens the email attachment, all 2004 bytes will be on one line?
Thanks |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Jan 18, 2006 6:10 am Post subject: |
|
|
Declan, could you post a copy of a hex dump of the first record of the file as it appears on the recipient's email system? |
|
Back to top |
|
 |
Declan Beginner
Joined: 04 May 2005 Posts: 15 Topics: 8
|
Posted: Wed Jan 18, 2006 6:18 am Post subject: |
|
|
Hi superk,
This is highly sensitive and confidential information.
What would you hope to see or determine from a hex dump?
Declan |
|
Back to top |
|
 |
advoss Beginner
Joined: 23 Aug 2005 Posts: 26 Topics: 0
|
Posted: Wed Jan 18, 2006 10:45 am Post subject: |
|
|
What is the LRECL of your attached file (and other DCB parameters)? An alternative might be to convert it to ASCII and send it as a binary file. _________________ Alan Voss |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Wed Jan 18, 2006 10:51 am Post subject: |
|
|
Declan wrote: | What would you hope to see or determine from a hex dump? |
I was thinking that it would be useful to know if the data does indeed contain record delimiters (CR/LF pairs). A quick test shows that it indeed does have more than just the one set of CR/LF pairs per 2004-byte record.
A test using a non-SAS method of attaching the same file did not contain any extra CR/LF characters, so it looks like it's a SAS issue. I didn't find anything on their web sites stating that there are any restrictions on the length of the file attachment.
I was going to make the same suggestion as advoss, or suggest that maybe you might want to take this issue up with SAS. |
|
Back to top |
|
 |
advoss Beginner
Joined: 23 Aug 2005 Posts: 26 Topics: 0
|
Posted: Wed Jan 18, 2006 3:58 pm Post subject: |
|
|
Superk, I think that you will find that "assumptions" are made when SAS translates from EBCDIC to ASCII to satisfy the CONTENT_TYPE="TEXT/PLAIN" option. In such cases, I try to translate to ASCII and then send as CONTENT_TYPE="image/gif". I know, it isn't an image file, but, bottom line, it treats it like a binary file and doesn't "help" me. _________________ Alan Voss |
|
Back to top |
|
 |
Declan Beginner
Joined: 04 May 2005 Posts: 15 Topics: 8
|
Posted: Thu Jan 19, 2006 8:50 am Post subject: |
|
|
Thanks for the input guys.
Can you possibly tell me how to convert EBCDIC to ASCII? Is it a command that must be added to the SAS? |
|
Back to top |
|
 |
superk Advanced

Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Thu Jan 19, 2006 9:22 am Post subject: |
|
|
It can be:
Code: |
//...
//TLIST DD DSN=THE.FILE.I.WANT.TO.ATTACH,
// DISP=SHR
//TLISTO DD DSN=THE.FILE.I.WANT.TO.ATTACH.ASCII,
// DISP=(,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(1,1),RLSE),
// RECFM=FB,LRECL=2004
//SYSIN DD DATA
DATA _NULL_;
INFILE TLIST;
FILE TLISTO;
INPUT @1 LINE1 $CHAR2004.;
PUT @1 LINE1 $ASCII2004.;
RUN;
|
|
|
Back to top |
|
 |
Declan Beginner
Joined: 04 May 2005 Posts: 15 Topics: 8
|
Posted: Mon Jan 30, 2006 10:24 am Post subject: |
|
|
Hi guys - I had a search through the SAS website and found that there is a problem with SAS and files with long record lengths.
SAS breaks longer records down into blocks of 990 bytes. My record contains 2004 bytes - therefore the 1st line of data would stop at byte 990, the 2nd line of data would stop at byte 1980, then I get a 3rd line of data for the remaining 24 bytes.
So it is a limitation of SAS.
Back to the drawing board! |
|
Back to top |
|
 |
Mervyn Moderator

Joined: 02 Dec 2002 Posts: 415 Topics: 6 Location: Hove, England
|
Posted: Mon Jan 30, 2006 10:54 am Post subject: |
|
|
Declan, thanks for the information. _________________ The day you stop learning the dinosaur becomes extinct |
|
Back to top |
|
 |
|
|