Page 1 of 2

Email w/ attachment error

PostPosted: Sun Feb 24, 2013 7:22 pm
by newjb
This is my second try at this...I am trying to setup an email that includes a text file attachment. With the attachment being a data file that I am including.


//JS40     EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//SYSUT1   DD  *
HELO XXX.XXX.XXX
MAIL FROM:<XXXX@XXX.XXX>
RCPT TO:<XXXX@XXX.XXX>
DATA
FROM: XXXX@XXX.XXX
SUBJECT:  TEST
TO: XXXX@XXX.XXX

 DAILY UPDATES
 THIS SHOULD CONTAIN A TEXT FILE ATTACHMENT
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=FILE.TXT
//         DD   DISP=SHR,DSN=BTEST.I.XXX.XXX.XXX.SORT
//         DD   *
.
QUIT
/*
//SYSUT2   DD  SYSOUT=(,),
//         OUTPUT=(*.OUTGRP02),
//         DEST=(XXXXXXXX,SMTP)
/*



==============================
OUTGRP02 is setup like this:

//OUTGRP02 OUTPUT CLASS=M



==============================
I keep getting this error message:

DATA SET UTILITY - GENERATE
IEB352I WARNING: ONE OR MORE OF THE OUTPUT DCB PARMS COPIED FROM INPUT,
IEB311I CONFLICTING DCB PARAMETERS,
IEB311I CONFLICTING DCB PARAMETERS,


Here are the setting of my data file:

DCB=(RECFM=FB,LRECL=180,BLKSIZE=27900),
SPACE=(TRK,(2000,2000),RLSE),
UNIT=DISK


Thank you in advance!!

One additional question about this: Is there a way to include the current date and time in either the email message or subject?

Re: Email w/ attachment error

PostPosted: Sun Feb 24, 2013 9:04 pm
by Robert Sample
SYSIN files are 80 bytes. You are concatenating a 180-byte record to this, hence, the error. You need to move the SYSIN data items into PDS members or separate files that have LRECL 180 and concatenate files of equal length.

Re: Email w/ attachment error

PostPosted: Sun Feb 24, 2013 10:30 pm
by newjb
Would you mind helping me with an example?

Re: Email w/ attachment error

PostPosted: Sun Feb 24, 2013 10:45 pm
by newjb
If used a different output format other than a text file would that make a difference?

Re: Email w/ attachment error

PostPosted: Sun Feb 24, 2013 10:47 pm
by BillyBoyo
//somename DD *


Wherever you see that, it is representing "card images". "Cards" or old punched-cards, which were fixed in width, 80 characters.

You have

//SYSUT1 DD *
stuff
// DD DSN=something
// DD *
other stuff


The first part of your "concatenation" is 80 bytes, then you have 180 bytes on your file, then 80 bytes again. This will not work, as you cannot mix LRECLs for fixed-length records on a concatenation.

If you take what you currently have as DD * (both of them) and put them on datasets (PS, PDS member, PDSE member) which are Fixed and have an LRECL of 180, then change your concatenation

//SYSUT1 DD DSN=new dataset with first set of data
// DD DSN=your original dataset
// DD DSN=new dataset with second set of data

Then you'll be able to concatenate the data successfully.

Re: Email w/ attachment error

PostPosted: Mon Feb 25, 2013 1:23 am
by newjb
So....the contents of my jcl will actually be included in the 2 new data files instead of within my actual job step right? (All 180)

If I just revised my 180 file and make it 80, would my existing original code then work as is?

Thanks again!

Re: Email w/ attachment error

PostPosted: Mon Feb 25, 2013 5:06 am
by NicC
Why not try?

Re: Email w/ attachment error

PostPosted: Mon Feb 25, 2013 7:07 pm
by Robert Sample
Have you looked at the Communications Server bookshelf to see what z/OS supports in SMTP? If not, why not? You are coming across as the rankest of rank beginners since it does not appear that you do any research on your own. Experienced professionals know how to test things on their own and see what is possible without having to be told on a forum.

For the date / time question you asked, have you tried this?
HELO XXX.XXX.XXX
MAIL FROM:<XXXX@XXX.XXX>
RCPT TO:<XXXX@XXX.XXX>
DATA
FROM: XXXX@XXX.XXX
SUBJECT:  TEST
TO: XXXX@XXX.XXX
DATE

Re: Email w/ attachment error

PostPosted: Tue Mar 05, 2013 11:13 pm
by newjb
You are correct... :shock: :( , I am the king of the beginners.... I have done a TON of research on my own.... it is just this is so different from PC / SQL Server development...taking some time for me even know the best places to research and even what to search for. Anyways, here is what I have figured out. This works great except for one issue. I don't know where the --SIMPLE BOUNDARY are needed. The below way will work (email is sent, w/ attachment) however, drops the first record. I've tried enclosing the --SIMPLE BOUNDARY around each section and attachment ends up being named: "ATT00001.txt" and within my attachment is all of my records (doesn't drop the first record) plus.... part of my code:
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=DETAILS.TXT

So I am getting an actual email, w/ attachment, & almost correct data. I think if I can figure out the rules on the boundaries...I will be good?

(my attached file is now LRECL=80) Thank you again!


//JS50     EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  DUMMY
//SYSUT1   DD  *
HELO XXX.XXX.XXXX
MAIL FROM:<XXXX@XXX.XXXX>
RCPT TO:<XXXX@XXX.XXXX>
DATA
FROM: XXXX@XXX.XXXX
SUBJECT: XXXXXX DETAILS
TO: XXXX@XXX.XXXX
MIME-VERSION: 1.0
CONTENT-TYPE: MULTIPART/MIXED; BOUNDARY="SIMPLE BOUNDARY"

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN;

 XXEMAIL MESSAGE TEXTXXXXX
 XXXXXXXXXXXXXXXXXXXXXXXXXXX

--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=DETAILS.TXT
//         DD   DISP=SHR,DSN=BTEST.I.XXXXX.XXXXX.UPD.SHRT
//         DD   *
.
QUIT
/*
//SYSUT2   DD  SYSOUT=(,),
//         OUTPUT=(*.OUTGRP02),
//         DEST=(XXXXXXXX,SMTP)
/*



Re: Email w/ attachment error

PostPosted: Tue Mar 05, 2013 11:29 pm
by Robert Sample
Try this:
--SIMPLE BOUNDARY
CONTENT-TYPE: TEXT/PLAIN
CONTENT-DISPOSITION: ATTACHMENT; FILENAME=DETAILS.TXT

//         DD   DISP=SHR,DSN=BTEST.I.XXXXX.XXXXX.UPD.SHRT
//         DD   *
.
I don't recall seeing anything in the RFC (but I might have just missed it) but a blank line right after the CONTENT-DISPOSITION seems to get the entire attachment across.