Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Automated e-mail with Rexx

427 views
Skip to first unread message

Hervey Martinez

unread,
Jan 3, 2008, 12:19:29 PM1/3/08
to
Hello,

Running in a Mainframe z/OS environment and just wondering if it's possible
to send an e-mail via batch JCL that would include a time computation? The
e-mail would look something like this:

*To: <my boss>*
*cc: <myself>, <other group members>*
**
*Subject: Estimated time*
**
*Body of e-mail: The estimated job completion is at ##.##
*
End of email

Where the ##.## will be computed from "current time + 2.5 hours"

In addition, I have no idea how to go about creating this Rexx; though, I'm
familiar with JCL but, sadly, don't have much Rexx experience.

Any guidance will be greatly appreciated.
--
Hervey

Don't sweat the small stuff....... It's all small stuff

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Jeff Byrum

unread,
Jan 3, 2008, 12:32:38 PM1/3/08
to
Check with your sysprog to see if you have the SMTP subsystem installed
and connected to your mail system. If so, you can generate and submit
JCL that looks like this:

//IEBGENER EXEC PGM=IEBGENER
//SYSIN DD DUMMY
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSUT1 DD *
HELO YOURMVS
RCPT TO: Micke...@somewhere.com
DATA
DATE: TODAY
SUBJECT: Whatever

Just a test.
.
QUIT

You can obviously generate any text you want in place of "Just a test.",
including your estimated job completion time.

I believe the blank line after the SUBJECT header is required. Also
note that "RCPT TO:" actually identifies the addressee, and you can have
multiple "RCPT TO:" lines. And yes, "HELO" is spelled "HELO"!

For more info, see IBM manual "z/OS Communications Server, IP User's
Guide and Commands."

Works great; we use it a lot, often with the email contents as an ISPF
skeleton that gets customized before submission.

Jeff

Ron Wells

unread,
Jan 3, 2008, 12:35:22 PM1/3/08
to
how about attachments..?

----------------------------------------------------------------------
Email Disclaimer
This E-mail contains confidential information belonging to the sender, which may be legally privileged information. This information is intended only for the use of the individual or entity addressed above. If you are not the intended recipient, or an employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, copying, distribution, or the taking of any action in reliance on the contents of the E-mail or attached files is strictly prohibited.

Lizette Koehler

unread,
Jan 3, 2008, 12:48:08 PM1/3/08
to
A couple of suggestions.

First browse the IBM Main archives, there has been a recent discussion on emailing from the mainframe. Using SMPT, HTTP, and other methods.

Second checkout the product XMITP. It uses the SMTP process to send email to and from the mainframe.


Lizette

Lindy Mayfield

unread,
Jan 3, 2008, 4:49:56 PM1/3/08
to
I know you totally weren't asking for this level of detail, but in case
you are curious, you can do it on a socket level. (-; Here is some
sample code that sends an email. Let me know if you need more
explanation than is in the code.

Cheers,
Lindy

/* rexx */
/*

Simple Email Test with attachment.

*/


trace Off
signal on halt
clear

/* Globals and Defaults */
verbose = 1 /* 1=verbose trace on, 0=off */
server = 'EMAILTST'
smtp = 'my.smtp.com' /* Name of smtp mail server */
/* smtp = '130.96.15.25' */ /* Name of smtp mail server */
crlf = '0D25'x
/* Email ids to send to, separated by a space */
emailid = "li...@me.com lin...@me.com"
emailfrom = "li...@me.com"
maxsocks = 3

/* Initialize */
srv = Socket('Initialize', server,maxsocks)
if verbose then
say 'Server Initialized ===>' srv

srv = Socket('GetHostId')
parse var srv src ipaddress
if verbose then
say 'gethostid retd ===>' srv

srv = Socket('Gethostname')
parse var srv src hostname
if verbose then
say 'gethnm retd ===>' srv


startDateTime = date() time()

Call SetEmailVars

Call sendTestmail

bye:

call Socket('Terminate')

Exit 0

/*-------------------------------------------------------------------*/
/* Name: sendTestmail */
/* Description: Proc to send a test email to an email */
/* Args: socket, email-id */
/* Returns: n/a */
/* */
/*-------------------------------------------------------------------*/
sendTestmail:


emailDateTime = date() time()

srv= Socket('Socket')
parse var srv src esockid
if verbose then
say 'socket retd ===>' srv
if src > 0 then signal bye

srv = Socket('Gethostbyname',smtp)
parse var srv src smtpip
if verbose then
say 'gethbynm retd ===>' srv

srv = Socket('Getdomainname')
parse var srv src domain
if verbose then
say 'getdomain retd ===>' srv

srv = Socket('Setsockopt',esockid,'SOL_SOCKET','SO_REUSEADDR','ON')
parse var srv src
if verbose then
say 'Setsockopt ===>' srv

srv = Socket('Setsockopt',esockid,'SOL_SOCKET','SO_LINGER','OFF')
parse var srv src
if verbose then
say 'Setsockopt ===>' srv

srv = Socket('Setsockopt',esockid,'SOL_SOCKET','SO_ASCII','ON')
parse var srv src
if verbose then
say 'Setsockopt ===>' srv

srv = Socket('Connect',esockid,'AF_INET' '25' smtpip)
parse var srv src
if verbose then
say 'Connect ===>' srv
If src > 0
then do
Say 'Connect to' smtp 'returned' srv
Say 'Email not sent'
Return
End

Say ' '
Say 'Connected to smtp server' smtp 'ip='smtpip 'port=25'
Say ' '

Say 'Email Transcript for' emailDateTime 'follows:'
Say ' '


Say 'r>>' readsock(esockid)

hostdom = hostname||"."||domain

stxt = 'HELO' hostdom||crlf
Call writesock esockid stxt
Say 's>>' stxt

Say 'r>>' readsock(esockid)

stxt = 'MAIL FROM:' emailfrom crlf
Call writesock esockid stxt
Say 's>>' stxt

Say 'r>>' readsock(esockid)


/* Code change to send to multiple people */
do i = 1 to words(emailid)
stxt = 'RCPT TO:' word(emailid,i) crlf
Call writesock esockid stxt
Say 's>>' stxt
Say 'r>>' readsock(esockid)
end

stxt = 'DATA' crlf
Call writesock esockid stxt
Say 's>>' stxt

Say 'r>>' readsock(esockid)


/* the following is just for testing */
stxt = "TO: li...@me.com" crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = "CC: lin...@me.com" crlf
Call writesock esockid stxt
Say 's>>' stxt
/* end testing/demonstration lines */


stxt = D1 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D2 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D3 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D4 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D5 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D6 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D7 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D8 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = D9 crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = ' ' crlf
Call writesock esockid stxt
Say 's>>' stxt

stxt = '.'
Call writesock esockid stxt
Say 's>>' stxt

stxt = crlf
Call writesock esockid stxt
Say 's>>' stxt

Say 'r>>' readsock(esockid)

stxt = 'QUIT' crlf
Call writesock esockid stxt
Say 's>>' stxt


srv = Socket('Close',esockid)
if verbose then
say 'Close returned ===>' srv
Say ' '
say 'Closing Connection to smtp server.'
Say ' '

return


/*-------------------------------------------------------------------*/
/* Name: readsock */
/* Description: Function to read from a socket */
/* Args: socket to read from */
/* Returns: Data read or NULL */
/* */
/*-------------------------------------------------------------------*/

readsock:
arg csock

dataline = ''
eol = 0

srv = Socket('Recv',csock)
parse var srv src len data
/* Ignore 35 & 36 for nonblocking. */
If src = 35 /* 35 is EWOULDBLOCK. Nothing to receive. */
then return ''
If src = 36 /* 36 is EINPROGRESS. Nothing to receive. */
then return ''
If src = 0 & len = 0 /* Zero length means that the client */
Then Do /* has disconnected. */
call closesock csock
return ''
end
If src = 0 /* Return code is zero and there is data... */
Then Do
if verbose then
say 'Received ('csock'):' len 'bytes from client'
return data
end
If src > 0 & src <> 35
Then
say 'Read Error ==>' srv

return ''


/*-------------------------------------------------------------------*/
/* Name: writesock */
/* Description: Proc to write data to a socket */
/* Args: socket to write to, data to write */
/* Returns: n/a */
/* */
/*-------------------------------------------------------------------*/

writesock:
parse arg csock stext

srv = Socket('Send',csock,stext)
parse var srv src len

if src /= 0
then do
parse var srv src rtxt
say "Error writing to socket("csock")." rtxt
end

if verbose then
say 'Send returned ===>' srv

return

/*-------------------------------------------------------------------*/
/* Name: closesock */
/* Description: Proc to close a socket */
/* Args: socket,flag to indicate whether to remove from array */
/* Returns: n/a */
/* */
/*-------------------------------------------------------------------*/
closesock:
arg cltsockid removefl

srv = Socket('Close',cltsockid)
if verbose then
say 'Close returned ===>' srv
say 'Closing Connection on socket' cltsockid

drop cmdbuffer.cltsockid

return


SetEmailVars:

D1 = "Subject: Rexx Attachment Email Test"

D2 = "Hi,"

D3 = "Here is a test of an attachment.

D4 = "Ciao,"
D5 = "Lindy"

D6 = "begin 644 attach.txt"
D7 = ";5&AI<R!I<R!A;B!A='1A8VAM96YT('1E<W0*"
D8 = ""
D9 = "end"

Return

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Hervey Martinez

Paul Gilmartin

unread,
Jan 3, 2008, 5:07:06 PM1/3/08
to
On Thu, Jan 03, 2008 at 10:49:36PM +0100, Lindy Mayfield wrote:
> I know you totally weren't asking for this level of detail, but in case
> you are curious, you can do it on a socket level. (-; Here is some
> sample code that sends an email. Let me know if you need more
> explanation than is in the code.
>
Of course, if you have sendmail available, you can pipe into
sendmail, which does much of this stuff for you.

Of course, someone must configure sendmail, but only once.

-- gil

Harrington, Mark

unread,
Jan 3, 2008, 5:11:13 PM1/3/08
to
I didn't get any code

Mark H.

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf

-- gil

----------------------------------------------------------
IMPORTANT WARNING: This email (and any attachments) is only intended for the use of the person or entity to which it is addressed, and may contain information that is privileged and confidential. You, the recipient, are obligated to maintain it in a safe, secure and confidential manner. Unauthorized redisclosure or failure to maintain confidentiality may subject you to federal and state penalties. If you are not the recipient, please immediately notify us by return email, and delete this message from your computer.
----------------------------------------------------------

Cruz, Robert

unread,
Jan 3, 2008, 5:32:40 PM1/3/08
to
Here's an alternative (decidedly old-school) method. Just submit a
jobstream like the following:

//EMAIL EXEC PGM=IEBGENER
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DATA,DLM=#$
HELO CTBMM1
MAIL FROM: <mvs...@mainframe.mvs>
RCPT TO: <to-rec...@to-domain.com>
RCPT TO: <cc-rec...@cc-domain.com>
DATA
Date: Thur, 18 May 2006 14:38:57 PST
From: mvs-user-name <mvs...@mainframe.com>
To: <to-rec...@to-domain.com>
Cc: <cc-rec...@cc-domain.com>
Subject: News from MVS

Testing, 1, 2, 3...
#$
/*

I have included the SYSUT1 above to show the format of the e-mail
records. Note that the less-than (<) and greater-than (>) symbols are
NOT meta-characters: they are to be coded as shown.

Your REXX program would build the appropriate text in a file and then
execute the JCL in either batch or via the TSO equivalents. Note: be
careful that the first RCPT TO is the same as the To: value, and the
second RCPT TO is the same as the CC:

Enjoy!

Cruz, Robert

unread,
Jan 3, 2008, 5:41:26 PM1/3/08
to
You will have to supply your own node-id in the HELO command (I
accidentally send my own in the previous e-mail)

I'm sure you'll want to change the date, too ;-)

-----Original Message-----
From: Cruz, Robert
Sent: Thu 03 Jan 2008 14:32
To: 'TSO REXX Discussion List'
Subject: RE: [TSO-REXX] Automated e-mail with Rexx

Here's an alternative (decidedly old-school) method. Just submit a
jobstream like the following:

//EMAIL EXEC PGM=IEBGENER
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DATA,DLM=#$

HELO node-id

Cruz, Robert

unread,
Jan 3, 2008, 6:12:23 PM1/3/08
to
If you are sending from a TSO session, or Batch TSO, rather than pure
MVS, the "SENDNOTE" command is the way to go. You can get info on this
in the "IBM TCP/IP for MVS" manual, or online by issuing the command:

TSO HELP SENDNOTE

SENDNOTE may be the simplest method available, as you specify the
addressee(s) and subject as command parameters, along with a dataset
containing the body of the e-mail.

-----Original Message-----
From: Cruz, Robert
Sent: Thu 03 Jan 2008 14:32
To: 'TSO REXX Discussion List'
Subject: RE: [TSO-REXX] Automated e-mail with Rexx

Here's an alternative (decidedly old-school) method. Just submit a
jobstream like the following:

//EMAIL EXEC PGM=IEBGENER
//SYSUT2 DD SYSOUT=(B,SMTP)
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD DATA,DLM=#$

HELO CTBMM1

Michael Bradley

unread,
Jan 4, 2008, 8:58:41 AM1/4/08
to
Robert said:
Just submit a
jobstream like the following:

//EMAIL EXEC PGM=IEBGENER
//SYSUT2 DD SYSOUT=(B,SMTP)

...

and for your purposes of doing this in batch, I think this is the simplest
way to go, as long as your message and addressees can be static.

But you mentioned REXX, and although REXX can implement Robert's solution
via EXEC PGM=IRXJCL, if you have a TSOBATCH proc available you can still
keep it simple, and exploit the SMTPNOTE capability. I have found this to
be far simpler to use than former solutions of queueing SMTP records.

SMTPNOTE can send tailored messages, albeit by writing the dynamic contents
to a file, or static messages contained in a file. It's documented in
"SC31-8780-05(+/- ) - z/OS Communications Server: IP User's Guide and
Commands" under SMTPNOTE Command. SMTPNOTE requires TSO because it employs
the TSO TRANSMIT command.

Michael

Mark Zelden

unread,
Jan 4, 2008, 9:10:57 AM1/4/08
to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> wrote on 01/03/2008
05:11:39 PM:

> If you are sending from a TSO session, or Batch TSO, rather than pure
> MVS, the "SENDNOTE" command is the way to go. You can get info on this
> in the "IBM TCP/IP for MVS" manual, or online by issuing the command:
>
> TSO HELP SENDNOTE
>
> SENDNOTE may be the simplest method available, as you specify the
> addressee(s) and subject as command parameters, along with a dataset
> containing the body of the e-mail.
>
>

ITYM SMTPNOTE.

Mark
--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:mark....@zurichna.com
z/OS Systems Programming expert at
http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html

******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information and is
intended solely for the addressee(s) named above. If you are not the
intended addressee/recipient, you are hereby notified that any use of,
disclosure, copying, distribution, or reliance on the contents of this
E-Mail/telefax information is strictly prohibited and may result in legal
action against you. Please reply to the sender advising of the error in
transmission and immediately delete/destroy the message and any
accompanying documents. Thank you.

Cruz, Robert

unread,
Jan 4, 2008, 11:42:29 AM1/4/08
to
You're right, it's SMTPNOTE !

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Mark Zelden
Sent: Fri 04 Jan 2008 06:11
To: TSO-...@VM.MARIST.EDU
Subject: Re: [TSO-REXX] Automated e-mail with Rexx

Bob Bridges

unread,
Oct 1, 2008, 9:21:25 PM10/1/08
to
I saved this post to look at later -- much later, as it turned out -- and
now that I search the IBM manuals for the SENDNOTE command I don't find it.
Could someone post a more exact title of the manual or, even better, a link
to it?

Alternatively, I did get a hit on the SMTPNOTE command; could the below be
a mistake?

---
Bob Bridges, rhb...@attglobal.net
cell 336 382-7313

/* "Poor Diogenes; if you knew how to get on with people you wouldn't have
to live like that." / "Poor Aristippos; if you knew how to live like this
you wouldn't have to get on with people." -a condensation of their
respective schools of thought a few centuries BC */

TSO HELP SENDNOTE

----------------------------------------------------------------------

Lionel B Dyck

unread,
Oct 1, 2008, 11:22:53 PM10/1/08
to
Another approach is to use XMITIP which is a free open-source tool with
several additions. Check it out at http://www.lbdsoftware.com

Lionel B. Dyck, Consultant/Specialist
Enterprise Platform Services, Mainframe Engineering
KP-IT Enterprise Engineering
925-926-5332 (8-473-5332) | E-Mail: Lionel...@kp.org
AIM: lbdyck | Yahoo IM: lbdyck
Kaiser Service Credo: "Our cause is health. Our passion is service. We're
here to make lives better."

I never guess. It is a capital mistake to theorize before one has data.
Insensibly one begins to twist facts to suit theories, instead of theories
to suit facts.
- Sir Arthur Conan Doyle

NOTICE TO RECIPIENT: If you are not the intended recipient of this e-mail,
you are prohibited from sharing, copying, or otherwise using or disclosing
its contents. If you have received this e-mail in error, please notify the
sender immediately by reply e-mail and permanently delete this e-mail and
any attachments without reading, forwarding or saving them. Thank you.


From:
Bob Bridges <rhb...@ATTGLOBAL.NET>
To:
TSO-...@VM.MARIST.EDU
Date:
10/01/2008 06:21 PM
Subject:
Re: [TSO-REXX] Automated e-mail with Rexx

Sent by:
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>

I saved this post to look at later -- much later, as it turned out -- and

Ken Leidner

unread,
Oct 2, 2008, 9:53:33 AM10/2/08
to
The command is SMTPNOTE which gives basic host email. Started out as an NJE
improved SEND command. I have done a lot to improve on the command but
take a look at the XMITIP "command".

In article <0b6501c9242d$1c1e8420$030fa8c0@rhblap1>, rhb...@ATTGLOBAL.NET
says...

Harrington, Mark

unread,
Oct 2, 2008, 1:57:11 PM10/2/08
to
/* REXX - EMAIL */
trace off
parse arg oncall msg
mail.1 = 'HELO' MVSVAR('SYSNAME')
mail.2 = 'MAIL FROM:<mharr...@mednet.ucla.edu>'
mail.3 = 'RCPT TO:<'oncall'>'
mail.4 = 'DATA'
mail.5 = 'FROM:<mharr...@mednet.ucla.edu>'
mail.6 = 'Subject: email msg'
mail.7 = msg
mail.8 = 'QUIT'
"ALLOC F(MAIL) SYSOUT(B) WRITER(SMTP)"
if RC <> 0 then say 'ALLOC error on MAIL'
"EXECIO * DISKW MAIL (STEM MAIL. FINIS"
if RC <> 0 then say 'EXECIO error on MAIL'
"FREE F(MAIL)"

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Lionel B Dyck
Sent: Wednesday, October 01, 2008 8:23 PM
To: TSO-...@VM.MARIST.EDU
Subject: Re: Automated e-mail with Rexx

TSO HELP SENDNOTE

IMPORTANT WARNING: This email (and any attachments) is only intended for the use of the person or entity to which it is addressed, and may contain information that is privileged and confidential. You, the recipient, are obligated to maintain it in a safe, secure and confidential manner. Unauthorized redisclosure or failure to maintain confidentiality may subject you to federal and state penalties. If you are not the intended recipient, please immediately notify us by return email, and delete this message from your computer.

Bob Bridges

unread,
Oct 2, 2008, 8:53:17 PM10/2/08
to
Oh, I'm a big fan of XMITIP, that hugely useful front end to SMTP on the
mainframe. I use it all the time, introduce it to my clients (who as often
as not were not aware it was already installed), write my own front ends to
the front end, as it were, and incorporate it into my work. I just figure
a second string to my bow is a good idea. And besides, trying out these
other methods gives me improved understanding of how email WORKS.

---
Bob Bridges, rhb...@attglobal.net
cell 336 382-7313

/* "Poor Diogenes; if you knew how to get on with people you wouldn't have
to live like that." / "Poor Aristippos; if you knew how to live like this
you wouldn't have to get on with people." -a condensation of their
respective schools of thought a few centuries BC */

-----Original Message-----
From: Lionel B Dyck
Sent: Wednesday, October 1, 2008 23:23

Another approach is to use XMITIP which is a free open-source tool with
several additions. Check it out at http://www.lbdsoftware.com

---
From: Bob Bridges <rhb...@ATTGLOBAL.NET>


Date: 10/01/2008 06:21 PM

I saved this post to look at later -- much later, as it turned out -- and


now that I search the IBM manuals for the SENDNOTE command I don't find
it. Could someone post a more exact title of the manual or, even better, a
link to it?

Alternatively, I did get a hit on the SMTPNOTE command; could the below be
a mistake?

-----Original Message-----

Miranda, John

unread,
Oct 3, 2008, 10:22:48 AM10/3/08
to
Is it possible to issue operator commands through REXX? I would like to issue the D PROG,LNKLST command and process the output in a REXX.

TIA

John M.

Grant Ward Able

unread,
Oct 3, 2008, 10:27:52 AM10/3/08
to
Yes you can - look in z/OS TSO/E System Programming Command Reference for
the CONSOLE command.

To use the CONSOLE environment, you must have TSO/E CONSOLE command
authority and an extended MCS console session must be active. You use the
TSO/E CONSOLE command to activate an extended MCS console session.

--
Regards - Grant
=====================================
Note: Any opinion expressed is my own


"Miranda, John" <john.m...@USAA.COM>


Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>

03/10/2008 15:22
Please respond to


TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>


To
TSO-...@VM.MARIST.EDU
cc

Subject
[TSO-REXX] Operator commands via REXX

TIA

John M.

-----------------------------------------
________________________________________________________
DTCC DISCLAIMER: This email and any files transmitted with it are
confidential and intended solely for the use of the individual or
entity to whom they are addressed. If you have received this email
in error, please notify us immediately and delete the email and any
attachments from your system. The recipient should check this email
and any attachments for the presence of viruses. The company
accepts no liability for any damage caused by any virus transmitted
by this email.

Seibert, Dave

unread,
Oct 3, 2008, 10:30:15 AM10/3/08
to
Hi John,

Yes. It is remarkably easy if you are at z/OS 1.9.

Here's a post with an example from back in February:

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Seibert, Dave
Sent: Friday, February 01, 2008 6:04 PM
To: TSO-...@VM.MARIST.EDU

Subject: Re: Calling SDSF in a Rexx exec

Note that when you get to z/OS 1.9, the tutorial panels for SDSF contain
excellent examples of the new Rexx interface.

Here's a small program I threw together after spending a few minutes
with the redbook and the examples.
I wrote it to issue the operator command to display DB2 WLM application
environments.
As always, it comes without warranty, apology, or much in the way of doc
or error handling.

/* REXX */
arg wlmenv
/* trace ?R */

/** Turn on ISF interface */
rc=isfcalls('ON')

/* Issue the Display WLM command */

Address SDSF "ISFEXEC '/d wlm,applenv="wlmenv"'"
lrc=rc

if lrc<>0 then
exit 20

say ' ';say ' ' ;say ' ' ; /* 'clrscrn' */

/* stem variable isfulog. has the output of the command.
The variable isfulog.0 contains a count of records.
The first 40 bytes are ignorable, so substring past them.
*/

numrows=isfulog.0
do i=1 to numrows /* Loop for all rows returned */
/* say isfulog.i */
say substr(isfulog.i,41)
end

Dave

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf

Rick Combest

unread,
Oct 3, 2008, 10:34:25 AM10/3/08
to
Just remember you will need CONSOLE authority which is set via the ACCOUNT command.

>>> "Seibert, Dave" <Dave.S...@COMPUWARE.COM> 10/3/2008 10:29 AM >>>

Bob Stark

unread,
Oct 3, 2008, 10:43:18 AM10/3/08
to
Here is an example that works pre-1.9.

It does not work if you have SDSF active in another split screen.

It requires a bit of security setup. Plan on taking your security
administrator to lunch.

/* CONSOLE2: REXX exec to issue an MVS command and get the response */
"CONSPROF SOLDISP(NO) UNSOLDISP(NO)" /* Don't display msgs on terminal*/
"CONSOLE ACTIVATE" /* Launch the CONSOLE command */
ADDRESS CONSOLE
"CART DLNKLIST" /* Tell console to use a CART */
"D PROG,LNKLST" /* Display linklist */

rc = GETMSG('CMDOUT.', 'SOL', 'DLNKLIST',,15) /* wait 15 secs for msgs*/
IF rc <> 0 THEN DO; SAY 'GETMSG() failed, rc='rc; EXIT; END
DO i = 1 TO cmdout.0
SAY cmdout.i
END i
ADDRESS TSO "CONSOLE DEACTIVATE" /* Terminate TSO CONSOLE command */


All in all, if I just needed to read the LNKLST, I'd dig it out of control
blocks using the following technique:


/* This REXX uses the CVT field CVTLLTA to locate the incore table of */
/* link list datasets. The datasets are then returned to the caller */
CVTLLTA = D2X(C2D(STORAGE(10,4))+1244)
CVTLLTA = D2X(C2D(STORAGE(D2X(C2D(STORAGE(10,4))+1244),4))+4)
dsn_cnt=C2D(STORAGE(CVTLLTA,4))
link_dsn=D2X(X2D(CVTLLTA)+4) /* POINT TO START OF DSNS */
/* */
/* LOOP THROUGH THE LINK LIST DATASETS */
/* Format of the LLT is 4 bytes of acronym */
/* then 4 bytes containing the binary count of number of */
/* linklist datasets. */
/* then each dataset entry consists of 45 bytes where byte 1*/
/* is the length of the dataset name, and the next 44 bytes */
/* is the name itself */
/* */
DO cnt=1 TO dsn_cnt
dsn_length=C2D(STORAGE(link_dsn,1))
link_dsn=D2X(X2D(link_dsn)+1) /* address dataset name */
dsn=STORAGE(link_dsn,dsn_length)
say dsn
link_dsn=D2X(X2D(link_dsn)+44) /* move to next entry */
END


Regards,

Bob Stark

ProTech - When you're serious about Systems Management
Consulting, Software, and Training for z/OS, UNIX and Internet
www.protechtraining.com 800-373-9188 x151 Mobile: 412-445-8072

Dave

TIA

John M.

--
If this email is spam, report it here:
http://www.onlymyemail.com/view/?action=reportSpam&Id=Mzg3MzE6NzYyMjg3MzczOm
JzdGFya0Bwcm90ZWNocHRzLmNvbQ%3D%3D

Jack Kelly

unread,
Oct 3, 2008, 11:18:32 AM10/3/08
to
<snip>

It does not work if you have SDSF active in another split screen
<unsnip>

I've found that it can work OK, if you're talking about RC04, if you use
another CN name, ie not the name used on the split screen SDSF (usually
tso uid)

Jack Kelly
202-502-2390 (Office)

Bob Stark

unread,
Oct 3, 2008, 11:51:02 AM10/3/08
to
Thanks Jack. Never used that NAME keyword. Here is a better example, this
time with some error checking.

/* CONSOLE2: REXX exec to issue an MVS command and get the response */

Do command = 1 To 1


/* Don't display msgs on terminal */

Address TSO "CONSPROF SOLDISP(NO) UNSOLDISP(NO)"
If rc <> 0 Then Leave command
Address TSO "CONSOLE ACTIVATE NAME(DLNKLST) CART(DLNKLST)"
If rc <> 0 Then Leave command

Address CONSOLE "D PROG,LNKLST" /* Display linklist */
If rc = 0 Then
Do
rc = GETMSG('CMDOUT.', 'SOL', 'DLNKLST',,15) /* wait 15 secs*/
If rc <> 0 THEN SAY 'GETMSG() failed, rc='rc
Else
Do i = 1 TO cmdout.0
Say cmdout.i
End i
End

Address TSO "CONSOLE DEACTIVATE" /* Terminate TSO CONSOLE command */
End command


Regards,

Bob Stark

ProTech - When you're serious about Systems Management
Consulting, Software, and Training for z/OS, UNIX and Internet
www.protechtraining.com 800-373-9188 x151 Mobile: 412-445-8072

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of
Jack Kelly
Sent: Friday, October 03, 2008 11:18 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: Operator commands via REXX

Jack Kelly
202-502-2390 (Office)

--


If this email is spam, report it here:

http://www.onlymyemail.com/view/?action=reportSpam&Id=Mzg3MzE6NzYyMzI3NTI5Om
JzdGFya0Bwcm90ZWNocHRzLmNvbQ%3D%3D

Bob Bridges

unread,
Oct 3, 2008, 12:16:30 PM10/3/08
to
At some installations I've had the authority to issue operator commands but
IIRC no one had gotten around to issuing us the CONSOLE authority in TSO -
at any rate we went into ACF2 or IOF to issue the operator commands, and I
did the same when automating the procedure in REXX. Dunno how it works in
the newer versions but this may be an alternative if your case is similar.

---
Bob Bridges, rhb...@attglobal.net
cell 336 382-7313

/* "Poor Diogenes; if you knew how to get on with people you wouldn't have
to live like that." / "Poor Aristippos; if you knew how to live like this
you wouldn't have to get on with people." -a condensation of their
respective schools of thought a few centuries BC */

-----Original Message-----
From: Grant Ward Able
Sent: Friday, October 3, 2008 10:27

Yes you can - look in z/OS TSO/E System Programming Command Reference for
the CONSOLE command.

To use the CONSOLE environment, you must have TSO/E CONSOLE command
authority and an extended MCS console session must be active. You use the
TSO/E CONSOLE command to activate an extended MCS console session.

--- "Miranda, John" <john.m...@USAA.COM>, 03/10/2008 15:22


Is it possible to issue operator commands through REXX? I would like to
issue the D PROG,LNKLST command and process the output in a REXX.

----------------------------------------------------------------------

Smith, Sean M

unread,
Oct 3, 2008, 1:21:25 PM10/3/08
to
I have been dealing with a SYSEXEC allocation issue which appears to be
related the EXECUTIL settings. Does anyone know a command to display
the EXECUTIL settings?

Sean

Mark Zelden

unread,
Oct 3, 2008, 1:54:35 PM10/3/08
to
TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> wrote on 10/03/2008
09:22:31 AM:

> Is it possible to issue operator commands through REXX? I would like to
issue the D
> PROG,LNKLST command and process the output in a REXX.
>
> TIA
>
> John M.
>

In addition to the console command / SDSF methods mentioned (which
all take more authority than a typical programmer has), you can
find the information by chasing down control blocks. Although these
control blocks are not GUPI and are not documented, they haven't
changed since dynamic APF / LNKLST existed.

For an example of LNKLST, APF and LPALST see the LPROG exec on my
web site (url below). The same code is also in IPLINFO.

Regards,

Mark
--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
Zurich North America / Farmers Insurance Group - ZFUS G-ITO
mailto:mark....@zurichna.com
z/OS Systems Programming expert at
http://expertanswercenter.techtarget.com/
Mark's MVS Utilities: http://home.flash.net/~mzelden/mvsutil.html


******************* PLEASE NOTE *******************
This E-Mail/telefax message and any documents accompanying this
transmission may contain privileged and/or confidential information and is

intended solely for the addressee(s) named above. If you are not the
intended addressee/recipient, you are hereby notified that any use of,


disclosure, copying, distribution, or reliance on the contents of this
E-Mail/telefax information is strictly prohibited and may result in legal
action against you. Please reply to the sender advising of the error in
transmission and immediately delete/destroy the message and any
accompanying documents. Thank you.

----------------------------------------------------------------------

Ryerse, Robin

unread,
Oct 3, 2008, 1:58:02 PM10/3/08
to
If all you want is a "look see", try DDLIST LNK. Same is true for
DDLIST APF

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf

Of Miranda, John
Sent: October 3, 2008 10:23 AM
To: TSO-...@VM.MARIST.EDU
Subject: Operator commands via REXX

Miranda, John

unread,
Oct 3, 2008, 2:21:28 PM10/3/08
to
How did you automate in REXX using IOF?

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Bob Bridges
Sent: Friday, October 03, 2008 11:16 AM
To: TSO-...@VM.MARIST.EDU

Bob Bridges

unread,
Oct 3, 2008, 4:50:15 PM10/3/08
to
IOF includes a built-in REXX interface, has for years; see their on-line
documentation at http://www.triangle-systems.com/iofdoc.shtml. The
interface is based on an address environment, so that your REXX program can
change over to IOF commands via "address IOF" or execute individual
commands by "address IOF <command>". The IOF commands let you navigate the
panels, run through rows and inspect individual fields -- ALL individual
fields, they claim, though I've never tested it -- on each row.

Back in 1999 or 2000 (for example) I used it to help a coworker who was
trying to tune CICS. I wrote him a REXX he could run once a day; it picked
out all the jobs with jobname CICS*, ran through them one at a time and,
for each one that had ended within the past day, drilled down to the proper
DDs and extracted the stats he wanted. After that it exported the data in
csv format, which was subsequently downloaded to Excel and reformatted via
VBA so he could compare all the CICS nightly stats by region and category,
but the point here is that finding the proper jobs and DD output was a snap
using the IOF interface. I haven't looked at SDSF's new REXX interface so
I don't know whether they're comparable.

---
Bob Bridges, rhb...@attglobal.net
cell 336 382-7313

/* Lazlo's Chinese Relativity Axiom: No matter how great your triumphs or
how tragic your defeats, approximately one billion Chinese couldn't care
less. */

-----Original Message-----
From: Miranda, John
Sent: Friday, October 3, 2008 14:21

How did you automate in REXX using IOF?

-----Original Message-----
From: Bob Bridges
Sent: Friday, October 03, 2008 11:16 AM

At some installations I've had the authority to issue operator commands but
IIRC no one had gotten around to issuing us the CONSOLE authority in TSO -
at any rate we went into ACF2 or IOF to issue the operator commands, and I
did the same when automating the procedure in REXX. Dunno how it works in
the newer versions but this may be an alternative if your case is similar.

----------------------------------------------------------------------

Robert Zenuk

unread,
Oct 3, 2008, 6:30:39 PM10/3/08
to
The new SDSF interface is almost identical... You use address SDSF and the
approach is the same. You issue a command (DA, ST, H, I, etc) and the data
is returned as stem variables (one for each column named the same as on the
ISFPARMS field definitions).

Here is a quick and dirty example of getting the DA data:

/* rexx - sdsf/rexx da */
if isfcalls('ON') <> 0 then exit 99
isfprefix = '*'
isfsort = 'cpupr d'
address SDSF "ISFEXEC DA"
do i=1 to isfrows
say left(jname.i,8) jobid.i sysname.i cpupr.i cpu.i
end
call isfcalls 'OFF'

Here is a quick and dirty example of executing a console command:

/* rexx - sdsf/rexx console command */
arg command
if isfcalls('ON') <> 0 then exit 99
address SDSF "ISFEXEC '/"command"' (WAIT"
do i=1 to isfulog.0
say isfulog.i
end
call isfcalls 'OFF'

Rob

In a message dated 10/3/2008 1:50:08 P.M. US Mountain Standard Time,
rhb...@ATTGLOBAL.NET writes:

**************New MapQuest Local shows what's happening at your destination.
Dining, Movies, Events, News & more. Try it out!
(http://local.mapquest.com/?ncid=emlcntnew00000001)

Rick Woods

unread,
Oct 6, 2008, 3:54:04 PM10/6/08
to
That is WICKED!
Thanks, Rob!
- Rick

>>> "Robert Zenuk" <Robz...@AOL.COM> 10/3/2008 3:30 PM >>>

Rob

documentation at http://www.triangle ( http://www.triangle/ )-systems.com/iofdoc.shtml. The

0 new messages