Steve Comstock wrote:
Steve Comstock wrote:
Bill Klein wrote:
I may be missing something, but if you know at compile-time (when you can set an environment variable) that you want the "output" to go to SYSOUT, why are you using "files" (with OPEN, WRITE, etc) and not just doing a DISPLAY
statement?  Either that or call CEEMSG.

I think those are "more normal" ways in COBOL to send output to SYSOUT.

"David Speake" <david.spe...@bcbssc.com> wrote in message
news:<listserv%200903152048381559.0...@bama.ua.edu>...
I have used dynamic allocation via the environmental variables in COBOL.
Thanks to Steve Comstock and others for getting me started.
But I see nothing about SYSOUT and it says a DSN is required.
My need is for a //X DD SYSOUT=(B,SMTP)

Bill,

He's not really sending things to a true SYSOUT file, but to an
email server. However, you could do such a thing by hardcoding
the DD name and opening the file, writing, then closing, and
then re-opening; each file should be sent separately.

Just leave a single DD statement, //MAILOUT  DD  SYSOUT=(B,SMTP)
if you like. No need for dynamic allocation at all.


Don't have time to test right now. I will if I get a chance later.

OK. Today I took some time and tested it. Works like a champ; it
just wasn't clear on the original post that the intent was to go
to SMTP.

So I wrote some code that sends 10 records to each entry in
a table of email addresses. The essential logic is:

open mailout
write email header records
write 10 data records
  (get input data record,
   format
   write it out) - 10 times
write email trailer records
close mailout

repeat that in a loop for each email addressee you have.

No need for dynamic allocation. Happy to send the code to
anyone who requests it.

Well, now that I look at things again, I see it works
except...

All the emails get concatenated in the SYSOUT file, and
only the first actually gets sent!

I had to rework the logic a little bit to only send a 'quit'
line after all the other messages had been sent. So now it
works as expected.



Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

303-393-8716
http://www.trainersfriend.com

  z/OS Application development made easier
    * Our classes include
       + How things work
       + Programming examples with realistic applications
       + Starter / skeleton code
       + Complete working programs
       + Useful utilities and subroutines
       + Tips and techniques

==> Check out the Trainer's Friend Store to purchase z/OS  <==
==> application developer toolkits. Sample code in four    <==
==> programming languages, JCL to Assemble or compile,     <==
==> bind and test.                                         <==
==>   http://www.trainersfriend.com/TTFStore/index.html    <==

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to