View previous topic :: View next topic
|
Author |
Message |
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
Hi,
For every month end we have to send the 9 reports to customer.So as of now we are doing it manual process like we do the FTP to transfer the files to PC and put it in the ZIP file and send to client.
Now my requirement is to automate this process.So I would like to know how we can ZIP multiple files and send to client through mainframe SAS.
If anyone have suggestions and sample code please provide.
Thanks,
Suresh |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Your File/Report resides in Mainframe ? |
|
Back to top |
|
|
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
magesh23586 wrote: |
Your File/Report resides in Mainframe ? |
Yes. File reports are resides in the mainframe PS file.We need to send this data to client in TXT format |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
Pls check your shop has PKZIP installed, if yes then you can use following code.
Code: |
//STEP05 EXEC PGM=PKZIP
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
-ARCHIVE(FILE.ZIP) ==> Output file
-ARCHTYPE(U) ==> Output dcb parameters
-ARCHBLKSIZ(27998)
-ARCHSPACE(TRK)
-ARCHPRIMARY(300)
-ARCHSECONDARY(30)
-ARCHUNIT(SAVDA)
-DELIM(CRLF)
-TEXT
FILE.TXT ==> Input file
|
|
|
Back to top |
|
|
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
Yes, we can use PKZIP in my shop. But I am not sure how we can implement the below requirement using PKZIP.
Requirement :
Currently 9 reports are resides in the 9 mainframe files. I need to follow below 3 steps to meet the requirement.
Step1 : First I need transfer and create 9 reports with .TXT format
Step2: Create a ZIP file to inlude all 9 files
Step3 : Send the ZIP file created from second step to the requester through Mainframe SAS.
I am aware to send a file alone via Mainframe SAS but not aware to send the ZIP file having multiple files.
Please suggest... |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
Use as many -INFILE statements as input files.
See the documentation. |
|
Back to top |
|
|
magesh23586
Active User
Joined: 06 Jul 2009 Posts: 213 Location: Chennai
|
|
|
|
You can specify multiple files at the end. Refer the below guide
Guide |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Hello,
If "ZIP the files" part is optional then you could use a SAS email job like the one below to send all text files in single email.
Code: |
//STEP1 EXEC SAS
//SYSIN DD *
FILENAME EMAIL EMAIL
FROM = ("WELLS@WELLS.COM")
TO = ("WELLS@WELLS.COM")
CC = ("WELLS@WELLS.COM")
REPLYTO=("WELLS@WELLS.COM")
SUBJECT="SOME SAMPLE TEST REPORT"
ATTACH=("MAINFRAME.FILE.THAT.IS.SENT.AS.ATTCHMENT" NAME='TEST FILE1' EXT='TXT')
ATTACH=("ANOTHER.MAINFRAME.FILE.THAT.IS.SENT.AS.ATTCHMENT" NAME='TEST FILE2' EXT='TXT')
ATTACH=("ANOTHER.MAINFRAME.FILE.THAT.IS.SENT.AS.ATTCHMENT" NAME='TEST FILE3' EXT='TXT');
DATA _NULL_;
FILE EMAIL;
PUT 'just look at these awesome attachments.. JUST LOOK AT THEM FOR GOD SAKE!!';
PUT 'THE EMAIL ENDS NOW ';
RUN;
/* |
Else if you really want the files to be zipped.
then run a PKZIP job and ZIP all mainframe files into a single ZIP file. and use the below job to send the ZIPPED file as attachment.
Code: |
//STEP1 EXEC SAS
//SYSIN DD *
FILENAME EMAIL EMAIL
FROM = ("WELLS@WELLS.COM")
TO = ("WELLS@WELLS.COM")
CC = ("WELLS@WELLS.COM")
REPLYTO=("WELLS@WELLS.COM")
SUBJECT="SOME SAMPLE TEST REPORT"
ATTACH=("ZIPPED.FILENAME.HERE" CT='APPLICATION/ZIP' NAME='SOME COOL NAME FOR ATTACHMENT' EXT='ZIP');
DATA _NULL_;
FILE EMAIL;
PUT 'just look at this awesome attachment. OMG..ALSO ZIPPED, JUST LOOK AT IT FOR GOD SAKE!!';
PUT 'THE EMAIL ENDS NOW ';
RUN;
/* |
|
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
sureshbabu.jv,
I missed one major flaw with the approach of zipping files on mainframe and sending them using SAS.
The files on mainframe are on EBCDIC encoding. When you ZIP the files in mainframe, the PKZIP application would ZIP it as EBCDIC files.
When the ZIP file is viewed in Windows it would appear as non interpretable data(garbage). Windows is based on ASCII encoding. You need to convert the EBCDIC files to ASCII encoding in the PKZIP zipping step and then send the ZIP'ed file as email.
Confusing Right? :-)
ASCII to EBCDIC in PKZIP - ibmmainframes.com/about20016-0.html |
|
Back to top |
|
|
sureshbabu.jv
New User
Joined: 11 Apr 2006 Posts: 41 Location: Chennai
|
|
|
|
Thanks for the responses!
Option1 is working to send the multiple files without ZIP.
And the below code has not worked for option2 i.e to ZIP the the multiple file.Its just added one file to ZIP file.
//SYSIN DD *
-ECHO
-ACTION(ADD)
-ARCHIVE_OUTFILE(ZIPFILE)
-ARCHIVE_OUTFILE(ZIPFILE1)
-COMPRESSION_LEVEL(NORMAL)
-DATA_DELIMITER(CR)
-DATA_TYPE(TEXT)
-FILE_EXTENSION(DROP|SUFFIX|NAMEFILE)
-FILE_TERMINATOR(CR)
-INFILE(INFILE)
-INFILE(INFILE1)
-ZIPPED_DSN(**,WINDOWS_FILE_NAME)
/*
And the below SAS control card is not working to tranmit the ZIP file.
FILENAME EMFILE EMAIL
FROM = ("WELLS@WELLS.COM")
TO = ("WELLS@WELLS.COM")
CC = ("WELLS@WELLS.COM")
REPLYTO=("WELLS@WELLS.COM")
SUBJECT="SOME SAMPLE TEST REPORT"
ATTACH=("WINDOWS_FILE_NAME" CT='APPLICATION/ZIP' NAME='Monthly report' EXT='ZIP');
DATA _NULL_;
FILE EMFILE;
PUT 'just look at this awesome attachment';
PUT 'THE EMAIL ENDS NOW ';
RUN;
/*
Getting the below Errors:
ERROR: Error in the FILENAME statement.
ERROR: Physical file does not exist, XBBLG8X.EMFILE.DATA.
NOTE: The SAS System stopped processing this step because of errors. |
|
Back to top |
|
|
vasanthz
Global Moderator
Joined: 28 Aug 2007 Posts: 1742 Location: Tirupur, India
|
|
|
|
Code: |
ERROR: Error in the FILENAME statement.
ERROR: Physical file does not exist, XBBLG8X.EMFILE.DATA.
NOTE: The SAS System stopped processing this step because of errors. |
this clearly says that the file XBBLG8X.EMFILE.DATA is missing. Is XBBLG8X.EMFILE.DATA the file you are trying to attach in email? |
|
Back to top |
|
|
|