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

How to ZIP and send the Multiple files through Mainframe SAS


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

New User


Joined: 11 Apr 2006
Posts: 41
Location: Chennai

PostPosted: Wed Nov 06, 2013 11:13 am
Reply with quote

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
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Nov 06, 2013 12:02 pm
Reply with quote

Your File/Report resides in Mainframe ?
Back to top
View user's profile Send private message
sureshbabu.jv

New User


Joined: 11 Apr 2006
Posts: 41
Location: Chennai

PostPosted: Wed Nov 06, 2013 12:33 pm
Reply with quote

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
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Nov 06, 2013 1:08 pm
Reply with quote

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
View user's profile Send private message
sureshbabu.jv

New User


Joined: 11 Apr 2006
Posts: 41
Location: Chennai

PostPosted: Wed Nov 06, 2013 2:15 pm
Reply with quote

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
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 06, 2013 2:35 pm
Reply with quote

Use as many -INFILE statements as input files.

See the documentation.
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 213
Location: Chennai

PostPosted: Wed Nov 06, 2013 3:13 pm
Reply with quote

You can specify multiple files at the end. Refer the below guide


Guide
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Wed Nov 06, 2013 9:39 pm
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Nov 07, 2013 3:34 am
Reply with quote

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
View user's profile Send private message
sureshbabu.jv

New User


Joined: 11 Apr 2006
Posts: 41
Location: Chennai

PostPosted: Thu Nov 07, 2013 8:17 am
Reply with quote

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
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Thu Nov 07, 2013 8:20 pm
Reply with quote

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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 1
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Mainframe openings in Techmahnidra fo... Mainframe Jobs 0
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top