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

Distinguishing between Rexx under TSO/ISPF and Rexx in batch?

677 views
Skip to first unread message

Farley, Peter x23353

unread,
Jul 1, 2010, 10:05:20 AM7/1/10
to
I am sure I saw this discussed at various times in the past, but for
some reason the search function on the TSO-REXX archive page does not
work from my PC (I never get any response, neither using IE6 nor Firefox
3.5.5).

I have tried to use the PARSE SOURCE instruction to see the difference,
but when running in batch under IKJEFT01 the values from PARSE SOURCE
seem to be identical to online TSO.

Here is the value of PARSE SOURCE that I see online under ISPF:

Source="TSO COMMAND MYEXEC SYS00148 TSOUSER.TEST.EXEC ? TSO ISPF ?"

And here it is from the TSO Ready prompt:

Source="TSO COMMAND MYEXEC SYS00166 TSOUSER.TEST.EXEC ? TSO TSO/E ?"

And here it is from batch under IKJEFT01:

Source="TSO COMMAND MYEXEC SYSEXEC TSOUSER.TEST.EXEC ? TSO TSO/E ?"

In all three cases, the Rexx is being executed as follows:

EXEC 'TSOUSER.TEST.EXEC(MYEXEC)' EXEC

So, gentle listers, is there another way to distinguish in which
environment a Rexx is operating? The goal here is not to ask
interactive questions in batch, but to take intelligent defaults for
that environment.

I can't use the DDName difference (SYSEXEC in batch vs SYSnnnnn online)
as a distinguishing feature, as the exec I am dealing with may wind up
in the online SYSEXEC and then there would be no difference again.

My apologies if this has been discussed previously, but since I can't
seem to search the archives I need to ask the question again.

Peter


This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

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

Andreas Fischer

unread,
Jul 1, 2010, 10:12:58 AM7/1/10
to
if you want to determine if a rexx program is executed in batch or foreground, use the sysvar('SYSENV') function

bye,
andi

George.William

unread,
Jul 1, 2010, 10:16:43 AM7/1/10
to
Try the sysvar('SYSENV') function. It returns FORE or BACK

SYSENV indicates whether the exec is running in the foreground or

background. SYSENV returns the following values:

o FORE - exec is running in the foreground

o BACK - exec is running in the background

You can use the SYSENV argument to make logical decisions
based
on foreground or background processing.

EXEC 'TSOUSER.TEST.EXEC(MYEXEC)' EXEC

Peter

______________________________________________________________________
CONFIDENTIALITY NOTICE: This email from the State of California is for the sole use of the intended recipient and may contain confidential and privileged information. Any unauthorized review or use, including disclosure or distribution, is prohibited. If you are not the intended recipient, please contact the sender and destroy all copies of this email.

Styles, Andy , Group IT

unread,
Jul 1, 2010, 10:17:01 AM7/1/10
to
Peter,

Try the SYSVAR function with SYSENV:

SYSENV
indicates whether the exec is running in the foreground or background.
SYSENV returns the following values:

FORE - exec is running in the foreground

BACK - exec is running in the background

--
Andy Styles

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf
Of Farley, Peter x23353
Sent: 01 July 2010 15:05
To: TSO-...@VM.MARIST.EDU
Subject: [TSO-REXX] Distinguishing between Rexx under TSO/ISPF and Rexx
in batch?

EXEC 'TSOUSER.TEST.EXEC(MYEXEC)' EXEC

Peter


Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500.

Bank of Scotland plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 327000. Telephone: 0870 600 5000

Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555.

Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372.

Lloyds TSB Bank plc, Lloyds TSB Scotland plc, Bank of Scotland plc and Cheltenham & Gloucester plc are authorised and regulated by the Financial Services Authority.

Halifax is a division of Bank of Scotland plc. Cheltenham & Gloucester Savings is a division of Lloyds TSB Bank plc.

HBOS plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 218813. Telephone: 0870 600 5000

Lloyds Banking Group plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 95000. Telephone: 0131 225 4555

This e-mail (including any attachments) is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it (including any attachments) immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments.

Telephone calls may be monitored or recorded.

Farley, Peter x23353

unread,
Jul 1, 2010, 10:17:33 AM7/1/10
to
Thank you! That is exactly what I need.

Regards,

Peter

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On
Behalf
> Of Andreas Fischer
> Sent: Thursday, July 01, 2010 10:13 AM
> To: TSO-...@vm.marist.edu
> Subject: Antwort: [TSO-REXX] Distinguishing between Rexx under
TSO/ISPF
> and Rexx in batch?
>

> if you want to determine if a rexx program is executed in batch or
> foreground, use the sysvar('SYSENV') function
>
> bye,
> andi

Farley, Peter x23353

unread,
Jul 1, 2010, 10:22:06 AM7/1/10
to
Thank you, as Adreas also said this is the way to do it.

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On
Behalf
> Of George.William
> Sent: Thursday, July 01, 2010 10:16 AM
> To: TSO-...@vm.marist.edu
> Subject: Re: Distinguishing between Rexx under TSO/ISPF and Rexx in
batch?
>

> Try the sysvar('SYSENV') function. It returns FORE or BACK
>
> SYSENV indicates whether the exec is running in the foreground or
>
> background. SYSENV returns the following values:
>
>
>
> o FORE - exec is running in the foreground
>
> o BACK - exec is running in the background
>
>
>
> You can use the SYSENV argument to make logical decisions
> based
> on foreground or background processing.

Farley, Peter x23353

unread,
Jul 1, 2010, 10:23:00 AM7/1/10
to
Thank you, as Adreas also said this is the way to do it.

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On
Behalf
> Of Styles, Andy (Group IT)
> Sent: Thursday, July 01, 2010 10:12 AM
> To: TSO-...@vm.marist.edu

> Subject: Re: Distinguishing between Rexx under TSO/ISPF and Rexx in
batch?
>

> Peter,
>
> Try the SYSVAR function with SYSENV:
>
> SYSENV
> indicates whether the exec is running in the foreground or background.
> SYSENV returns the following values:
>
> FORE - exec is running in the foreground
> BACK - exec is running in the background

Paul Gilmartin

unread,
Jul 1, 2010, 10:24:24 AM7/1/10
to
On Jul 1, 2010, at 08:16, George.William wrote:

> Try the sysvar('SYSENV') function. It returns FORE or BACK
>

Sometimes:

user@MVS$ rexx "trace R; parse source .; say sysvar('SYSENV')"
1 *-* parse source .
>.> "TSO COMMAND /u/user/bin/rexx PATH /u/user/bin/rexx ? SH OMVS OpenMVS"
*-* say sysvar('SYSENV')
1 +++ say sysvar('SYSENV')
1 +++ /* REXX Useful! */ interpret arg(1)
IRX0043I Error running /mvsoeecc/sppg/bin/rexx, line 1: Routine not found

If the OP intends not to support the IRXJCL or OMVS environment, he
should at least detect them and fail gracefully.

-- gil

Farley, Peter x23353

unread,
Jul 1, 2010, 10:40:58 AM7/1/10
to
Since the Rexx in question needs TSO ALLOC to operate, IRXJCL isn't a
design goal, but you are correct that the routine should detect that
condition and fail gracefully. Thanks for the reminder.

I can't even test Rexx under OMVS, since it doesn't appear to be
available under OMVS where I am. Just typing "rexx" as a command with
the argument you used gets "not found" for the command. I can test the
SOURCE for OpenMVS though, and will do so.

Peter

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On
Behalf
> Of Paul Gilmartin
> Sent: Thursday, July 01, 2010 10:24 AM
> To: TSO-...@vm.marist.edu

> Subject: Re: Distinguishing between Rexx under TSO/ISPF and Rexx in
batch?
>

> On Jul 1, 2010, at 08:16, George.William wrote:
>
> > Try the sysvar('SYSENV') function. It returns FORE or BACK
> >
> Sometimes:
>
> user@MVS$ rexx "trace R; parse source .; say sysvar('SYSENV')"
> 1 *-* parse source .
> >.> "TSO COMMAND /u/user/bin/rexx PATH /u/user/bin/rexx ? SH
> OMVS OpenMVS"
> *-* say sysvar('SYSENV')
> 1 +++ say sysvar('SYSENV')
> 1 +++ /* REXX Useful! */ interpret arg(1)
> IRX0043I Error running /mvsoeecc/sppg/bin/rexx, line 1: Routine not
found
>
> If the OP intends not to support the IRXJCL or OMVS environment, he
> should at least detect them and fail gracefully.

This message and any attachments are intended only for the use of the addressee and
may contain information that is privileged and confidential. If the reader of the
message is not the intended recipient or an authorized representative of the
intended recipient, you are hereby notified that any dissemination of this
communication is strictly prohibited. If you have received this communication in
error, please notify us immediately by e-mail and delete the message and any
attachments from your system.

Thomas Berg

unread,
Jul 1, 2010, 10:44:20 AM7/1/10
to
I'm using this for determine "foreground":

cvt = Efptr(16)
tcb = Efptr(cvt)
ascbo = Efptr(tcb+12)
ascbtsb = Efptr(ascbo+60)
If ascbtsb > 0 Then f.0terminal = 1

/*-------------------------------------------------------------------*/
EFPTR: Procedure
Return X2d(C2x(Bitand('7FFFFFFF'x,Storage(D2x(Arg(1)),4))))


 
Regards,
Thomas Berg
_________________________________________
Thomas Berg   Specialist   A M   SWEDBANK


> -----Ursprungligt meddelande-----
> Från: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] För Paul
> Gilmartin
> Skickat: den 1 juli 2010 16:24
> Till: TSO-...@VM.MARIST.EDU
> Ämne: Re: [TSO-REXX] Distinguishing between Rexx under TSO/ISPF and Rexx
> in batch?
>

Mark S Zelden

unread,
Jul 1, 2010, 11:10:34 AM7/1/10
to
> I can't even test Rexx under OMVS, since it doesn't appear to be
> available under OMVS where I am. Just typing "rexx" as a command with
> the argument you used gets "not found" for the command. I can test the
> SOURCE for OpenMVS though, and will do so.
>

You don't type "rexx cmd_name". You just execute a rexx exec from
a shell. IOW, create a file named whatever you want (although some
people like to use a ".rexx" extension) and execute it.

For example, you can just copy my iplinfo exec "as is" into a z/OS
unix file and from the command line type "iplinfo"
or "iplinfo _option_".

Regards,

Mark
--
Mark Zelden
Sr. Software and Systems Architect - z/OS Team Lead
CSC - Zurich/Farmers Account

Jeremy Nicoll - ls tsrx

unread,
Jul 1, 2010, 11:23:22 AM7/1/10
to
"Farley, Peter x23353" <Peter....@BROADRIDGE.COM> wrote:

> I am sure I saw this discussed at various times in the past, but for
> some reason the search function on the TSO-REXX archive page does not
> work from my PC (I never get any response, neither using IE6 nor Firefox
> 3.5.5).
>
> I have tried to use the PARSE SOURCE instruction to see the difference,
> but when running in batch under IKJEFT01 the values from PARSE SOURCE
> seem to be identical to online TSO.
>
> Here is the value of PARSE SOURCE that I see online under ISPF:
>
> Source="TSO COMMAND MYEXEC SYS00148 TSOUSER.TEST.EXEC ? TSO ISPF ?"

^^^^

Surely that one shows ISPF, whereas the following examples do not?

I would imagine it would show ISPF whether you're running in fg or bg.

What happens if you try issuing an "address ispexec" when ispf is not
available? If that works, how about trying an actual ispf command and
testing the rc?

--
Jeremy C B Nicoll - my opinions are my own.

Paul Gilmartin

unread,
Jul 1, 2010, 11:40:13 AM7/1/10
to
On Jul 1, 2010, at 08:40, Farley, Peter x23353 wrote:

> Since the Rexx in question needs TSO ALLOC to operate, IRXJCL isn't a
> design goal, but you are correct that the routine should detect that
> condition and fail gracefully. Thanks for the reminder.
>

Except for an irritating few unimplemented keywords and some
irritating lexical restrictions, BPXWDYN is an acceptable
substitute. And RTDSN, RTDDN, and RTVOL are invaluable for
temp allocations.

> I can't even test Rexx under OMVS, since it doesn't appear to be
> available under OMVS where I am. Just typing "rexx" as a command with
> the argument you used gets "not found" for the command. I can test the
> SOURCE for OpenMVS though, and will do so.
>

Ah! You need my magic script:

user@MVS:115$ head rexx /dev/null
==> rexx <==


/* REXX Useful! */ interpret arg(1)

I keep one in my UNIX executable search path; another in SYSEXEC.

Under VM/CMS, at least, there's an instruction:

SUBCOM name

to test whether a given host command environment is available.
It's distressing that TSO Rexx appears not to implement this,
and leaves it to the user to contrive a harmless no-op to
test for each host command environment. IIRC, ISPF provides
one; I'm not going to RTFM just now.

-- gil

Captain Paralytic

unread,
Jul 1, 2010, 5:49:27 PM7/1/10
to
On Jul 1, 4:23 pm, jn.ls.tsrx...@WINGSANDBEAKS.ORG.UK (Jeremy Nicoll -
ls tsrx) wrote:

> "Farley, Peter x23353" <Peter.Far...@BROADRIDGE.COM> wrote:
>
> > I am sure I saw this discussed at various times in the past, but for
> > some reason the search function on the TSO-REXX archive page does not
> > work from my PC (I never get any response, neither using IE6 nor Firefox
> > 3.5.5).
>
> > I have tried to use the PARSE SOURCE instruction to see the difference,
> > but when running in batch under IKJEFT01 the values from PARSE SOURCE
> > seem to be identical to online TSO.
>
> > Here is the value of PARSE SOURCE that I see online under ISPF:
>
> > Source="TSO COMMAND MYEXEC SYS00148 TSOUSER.TEST.EXEC ? TSO ISPF ?"
>
>                                                               ^^^^
>
> Surely that one shows ISPF, whereas the following examples do not?
>
> I would imagine it would show ISPF whether you're running in fg or bg.
>
> What happens if you try issuing an "address ispexec" when ispf is not
> available?  If that works, how about trying an actual ispf command and
> testing the rc?
That wouldn't help him know if it was running in TSO fg or bg.
0 new messages