Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to ZIP and send the Multiple files through Mainframe SAS

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: How to ZIP and send the Multiple files through Mainframe SAS
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: 158
Location: Chennai

PostPosted: Wed Nov 06, 2013 12:02 pm    Post subject: Reply to: How to ZIP and send the Multiple files through Mai
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    Post subject: Re: Reply to: How to ZIP and send the Multiple files through
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: 158
Location: Chennai

PostPosted: Wed Nov 06, 2013 1:08 pm    Post subject: Reply to: How to ZIP and send the Multiple files through Mai
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    Post subject: Re: Reply to: How to ZIP and send the Multiple files through
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Wed Nov 06, 2013 2:35 pm    Post subject:
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: 158
Location: Chennai

PostPosted: Wed Nov 06, 2013 3:13 pm    Post subject: Reply to: How to ZIP and send the Multiple files through Mai
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: 1445
Location: Azeroth

PostPosted: Wed Nov 06, 2013 9:39 pm    Post subject:
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: 1445
Location: Azeroth

PostPosted: Thu Nov 07, 2013 3:34 am    Post subject:
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 - http://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    Post subject:
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: 1445
Location: Azeroth

PostPosted: Thu Nov 07, 2013 8:20 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
This topic is locked: you cannot edit posts or make replies. Urgent Mainframe Requirments (2-10 yr... Shankar779 Mainframe Jobs 0 Sun Nov 27, 2016 1:48 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. Mainframe Developer requirement in Ku... capricorn Mainframe Jobs 0 Sun Oct 23, 2016 3:49 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us