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

How to MOD a dataset with EXECIO

1,668 views
Skip to first unread message

Lizette Koehler

unread,
Dec 9, 2010, 6:34:30 PM12/9/10
to
Okay, I have been trying to get this one little snippet of code working and
for some reason, it escapes me. If I execute this once per day I am good.
But if done multiple times in a day, the dataset only has the entries from
the last run.

I do the following

Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD "


Some code to queue data then

"EXECIO " QUEUED() " DISKW PDSM1A(FINIS "

Each time the MOD acts like OLD. Am I missing something??

Psuedo Process

Do Loop to build control cards to QUEUE

Allocate output file with MOD

EXECIO write out the queued stuff.

This is all done in one self contained section of code. I am not going in
and out of this code. I am not using PUSH or NEWSTACK/DELSTACK.

Thoughts? Suggestions?

Lizette


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

Paul Gilmartin

unread,
Dec 9, 2010, 7:01:26 PM12/9/10
to
On 2010-12-09 16:33, Lizette Koehler wrote:
> Okay, I have been trying to get this one little snippet of code working and
> for some reason, it escapes me. If I execute this once per day I am good.
> But if done multiple times in a day, the dataset only has the entries from
> the last run.
> ...

> This is all done in one self contained section of code. I am not going in
> and out of this code. I am not using PUSH or NEWSTACK/DELSTACK.
>
> Thoughts? Suggestions?
>
<SERMON>
I know it's a personal bias, but I avoid using the stack.
I use a stem instead. Storage utilization should be comparable.
You need a very few additional lines to manage the tail/index.
And if you have a loop control variable, that can double as the
index.

Or, if the data are small, you can EXECIO one line at a time.

The stack entails the same hazards as USERKEYCSA, in my
perception. You never know what other code will manipulate
it, not even your own.
</SERMON>

-- gil

Robert Zenuk

unread,
Dec 9, 2010, 9:30:27 PM12/9/10
to
Here is the code modified to use a stem... Line 12 is still DISKW

/* REXX - MODTEST */
modtest.1 = time(l)
modtest.2 = time(l)
modtest.3 = time(l)
modtest.4 = time(l)
modtest.5 = time(l)
modtest.6 = time(l)
modtest.7 = time(l)
modtest.8 = time(l)
modtest.9 = time(l)
"ALLOC F(MODTEST) DA('OPSROZ.MODTEST') MOD"
"EXECIO * DISKW MODTEST (STEM MODTEST. FINIS"
"EXECIO * DISKR MODTEST (STEM MODTEST. FINIS"
do i=1 to modtest.0
say strip(modtest.i)
end
"FREE F(MODTEST)"


Rob

In a message dated 12/9/2010 5:41:22 P.M. US Mountain Standard Time,
Robz...@aol.com writes:

Look at the code again (line 4)... The DISKR was simply a confirmation
run AFTER the DISKW to make sure the process was actually MODing onto the end
of the file...

> 000001 /* REXX - MODTEST */
> 000002 queue time()
> 000003 "ALLOC F(MODTEST) DA('my.seqdsn') MOD"
> 000004 "EXECIO" queued() "DISKW MODTEST (FINIS"
> 000005 "EXECIO * DISKR MODTEST (STEM MODTEST. FINIS"
> 000006 do i=1 to modtest.0
> 000007 say strip(modtest.i)
> 000008 end

Like Gil, I also prefer STEM's, but tried exactly what you were doing.

Rob


In a message dated 12/9/2010 5:37:22 P.M. US Mountain Standard Time,
star...@MINDSPRING.COM writes:

Rob,
The PDSM is probably misleading. It stand for PDSMAN. The file being used
is a SEQ file and not a PDS.

Your example is using DISKR and I am trying to use DISKW.

So I do the following

ADDRESS TSO "ALLOC DD(OUTSEQ) DA('"PDSMSEQ"') MOD"

Do I = 1 to Stem.0
Queue stem.i
End
" EXECIO " QUEUED() " OUTSEQ (FINIS "

On the first run of this process, it is good. But subsequent runs the MOD
acts like OLD and just replaces the contents rather than adding on to the
end of the file.

I am going to work with pure stems next and see if that behaves better like
Gil offered.

Lizette


> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> Behalf Of Robert Zenuk
> Sent: Thursday, December 09, 2010 7:28 PM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO
>
> From your naming convention it looks like you are trying to use a
> PDS(member)... As far as I know, MOD only works with sequential
> files... The
> following works fine with a sequential file...
>
> 000001 /* REXX - MODTEST */
> 000002 queue time()
> 000003 "ALLOC F(MODTEST) DA('my.seqdsn') MOD"
> 000004 "EXECIO" queued() "DISKW MODTEST (FINIS"
> 000005 "EXECIO * DISKR MODTEST (STEM MODTEST. FINIS"
> 000006 do i=1 to modtest.0
> 000007 say strip(modtest.i)
> 000008 end
>
> Executing it multiple times works as expected.
>
> When I tried it with a PDS member, it worked the first time then I got
> a
> B14-04 for all successive attempts. I guess MOD for a PDS member
> attempts
> to STOW the member name at CLOSE time and finds a duplicate name.
>
> Rob
>
>
>
>
> In a message dated 12/9/2010 4:33:49 P.M. US Mountain Standard Time,


> star...@MINDSPRING.COM writes:
>
> Okay, I have been trying to get this one little snippet of code
> working and
> for some reason, it escapes me. If I execute this once per day I am
> good.
> But if done multiple times in a day, the dataset only has the entries
> from
> the last run.
>
>
>

> I do the following
>
>
>
> Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD "
>
>
>
>
> Some code to queue data then
>
>
>
> "EXECIO " QUEUED() " DISKW PDSM1A(FINIS "
>
>
>
> Each time the MOD acts like OLD. Am I missing something??
>
>
>
> Psuedo Process
>
>
>
> Do Loop to build control cards to QUEUE
>
>
>
> Allocate output file with MOD
>
>
>
> EXECIO write out the queued stuff.
>
>
>

> This is all done in one self contained section of code. I am not
> going in
> and out of this code. I am not using PUSH or NEWSTACK/DELSTACK.
>
>
>
> Thoughts? Suggestions?
>
>
>

> Lizette

Robert Zenuk

unread,
Dec 9, 2010, 9:30:50 PM12/9/10
to

Thom Stone

unread,
Dec 9, 2010, 9:00:28 PM12/9/10
to
I don't use the stack or queue very often, I prefer stems, but I remember
something about queueing a blank or null line at the end of the queue before
you do your EXECIO. Could that help?
Thom

Lizette Koehler

unread,
Dec 9, 2010, 9:08:49 PM12/9/10
to
Thanks for all the help so far. I have tried various iterations of QUEUE
and STEM and it does not seem to behave the way I want.

The initial execution of the REXX is fine. The EXECIO writes out the lines
correctly. However, if I go and execute the rexx later (a min/hr.day) then
it replaces the output dataset rather than mod onto the end.

I am starting to think the EXECIO may have some limitations I am not
familiar with. So I am going with PLAN B. I will create an ISPF SKEL and
then I will get what I want.

Lizette

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> Behalf Of Robert Zenuk
> Sent: Thursday, December 09, 2010 7:48 PM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO
>

> Here is the code modified to use a stem... Line 12 is still DISKW
>
> /* REXX - MODTEST */
> modtest.1 = time(l)
> modtest.2 = time(l)
> modtest.3 = time(l)
> modtest.4 = time(l)
> modtest.5 = time(l)
> modtest.6 = time(l)
> modtest.7 = time(l)
> modtest.8 = time(l)
> modtest.9 = time(l)
> "ALLOC F(MODTEST) DA('OPSROZ.MODTEST') MOD"
> "EXECIO * DISKW MODTEST (STEM MODTEST. FINIS"
> "EXECIO * DISKR MODTEST (STEM MODTEST. FINIS"
> do i=1 to modtest.0
> say strip(modtest.i)
> end
> "FREE F(MODTEST)"
>
>
> Rob
>
>

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

Tony Harminc

unread,
Dec 9, 2010, 9:08:42 PM12/9/10
to
On 9 December 2010 19:37, Steve Comstock <st...@trainersfriend.com> wrote:

> Have you tried:
>
>  Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD REU  "
>
> just a shot in the dark.

REUSE has nothing to do with MOD - it applies to the DDNAME - but you
have an interesting point: what if DDNAME PDSM1 was already allocated
to DSNAME PDSMSYM as OLD? Would another ALLOCATE with identical DDNAME
and DSNAME but with MOD do anything at all, or would it consider the
allocation to be satisfied already?

Hmmm... on my system it prompts with "file in use" (i.e. DDNAME in
use), "enter FREE or END". So much for that theory.

Tony H.

John McKown

unread,
Dec 9, 2010, 9:18:41 PM12/9/10
to
As Steve Comstock said, put in REUSE on the ALLOC. If the DD is already
allocated, the ALLOC is ignored unless you use REUSE.

On Thu, 2010-12-09 at 19:36 -0500, Lizette Koehler wrote:
> Rob,
> The PDSM is probably misleading. It stand for PDSMAN. The file being used
> is a SEQ file and not a PDS.
>
> Your example is using DISKR and I am trying to use DISKW.
>
> So I do the following
>
> ADDRESS TSO "ALLOC DD(OUTSEQ) DA('"PDSMSEQ"') MOD"
>
> Do I = 1 to Stem.0
> Queue stem.i
> End
> " EXECIO " QUEUED() " OUTSEQ (FINIS "
>
> On the first run of this process, it is good. But subsequent runs the MOD
> acts like OLD and just replaces the contents rather than adding on to the
> end of the file.
>
> I am going to work with pure stems next and see if that behaves better like
> Gil offered.
>

> Lizette
>
>
> > -----Original Message-----
> > From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> > Behalf Of Robert Zenuk
> > Sent: Thursday, December 09, 2010 7:28 PM
> > To: TSO-...@VM.MARIST.EDU
> > Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO
> >

> > Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD "
> >
> >
> >
> >

> > Some code to queue data then
> >
> >
> >
> > "EXECIO " QUEUED() " DISKW PDSM1A(FINIS "
> >
> >
> >
> > Each time the MOD acts like OLD. Am I missing something??
> >
> >
> >
> > Psuedo Process
> >
> >
> >
> > Do Loop to build control cards to QUEUE
> >
> >
> >
> > Allocate output file with MOD
> >
> >
> >
> > EXECIO write out the queued stuff.
> >
> >
> >
> > This is all done in one self contained section of code. I am not
> > going in
> > and out of this code. I am not using PUSH or NEWSTACK/DELSTACK.
> >
> >
> >
> > Thoughts? Suggestions?
> >
> >
> >
> > Lizette
> >
> >
> >
> >

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

--
John McKown
Maranatha! <><

Robert Zenuk

unread,
Dec 9, 2010, 9:37:38 PM12/9/10
to
Is your code too long to post? I was never able to achieve the behavior
you are seeing... It either worked every time (sequential file) or worked
once then failed with a B14-04 when using a PDS member. Are you freeing and
reallocating the file again in your code somewhere?

Rob

In a message dated 12/9/2010 7:08:37 P.M. US Mountain Standard Time,
star...@MINDSPRING.COM writes:

Thanks for all the help so far. I have tried various iterations of QUEUE
and STEM and it does not seem to behave the way I want.

The initial execution of the REXX is fine. The EXECIO writes out the
lines
correctly. However, if I go and execute the rexx later (a min/hr.day) then
it replaces the output dataset rather than mod onto the end.

I am starting to think the EXECIO may have some limitations I am not
familiar with. So I am going with PLAN B. I will create an ISPF SKEL and
then I will get what I want.

Lizette

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On
> Behalf Of Robert Zenuk
> Sent: Thursday, December 09, 2010 7:48 PM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO
>

> Here is the code modified to use a stem... Line 12 is still DISKW
>

> /* REXX - MODTEST */

> modtest.1 = time(l)
> modtest.2 = time(l)
> modtest.3 = time(l)
> modtest.4 = time(l)
> modtest.5 = time(l)
> modtest.6 = time(l)
> modtest.7 = time(l)
> modtest.8 = time(l)
> modtest.9 = time(l)
> "ALLOC F(MODTEST) DA('OPSROZ.MODTEST') MOD"
> "EXECIO * DISKW MODTEST (STEM MODTEST. FINIS"

> "EXECIO * DISKR MODTEST (STEM MODTEST. FINIS"

> do i=1 to modtest.0
> say strip(modtest.i)
> end
> "FREE F(MODTEST)"
>
>
> Rob
>
>

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

Steve Comstock

unread,
Dec 10, 2010, 12:19:06 AM12/10/10
to
On 12/9/2010 6:22 PM, Tony Harminc wrote:
> On 9 December 2010 19:37, Steve Comstock<st...@trainersfriend.com> wrote:
>
>> Have you tried:
>>
>> Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD REU "
>>
>> just a shot in the dark.
>
> REUSE has nothing to do with MOD - it applies to the DDNAME - but you
> have an interesting point: what if DDNAME PDSM1 was already allocated
> to DSNAME PDSMSYM as OLD? Would another ALLOCATE with identical DDNAME
> and DSNAME but with MOD do anything at all, or would it consider the
> allocation to be satisfied already?
>
> Hmmm... on my system it prompts with "file in use" (i.e. DDNAME in
> use), "enter FREE or END". So much for that theory.
>
> Tony H.

Ah, well. Just a thought from an airport waiting area.
Too bad.

--

Kind regards,

-Steve Comstock
The Trainer's Friend, Inc.

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

* To get a good Return on your Investment, first make an investment!
+ Training your people is an excellent investment

* Try our new tool for calculating your Return On Investment
for training dollars at
http://www.trainersfriend.com/ROI/roi.html

Andreas Fischer

unread,
Dec 10, 2010, 3:08:40 AM12/10/10
to
just being curious now... i use the stack when calling functions that will
return an unknown number of elements, example giving, i wrote a function
that uses the catalog search interface that will queue the matching
catalog entries in the stack and just return the number of elements in the
stack. same thing with racf stuff like determing data set profiles or
connected userids.

any suggestions how to avoid the stack and do it smarter? i thought myself
it's more useful than returning endless strings and parse them in the main
program then.

bye,
andi


TSO REXX Discussion List <TSO-...@VM.MARIST.EDU> schrieb am 10.12.2010
01:00:39:

Styles, Andy , TME - Systems Management Services

unread,
Dec 10, 2010, 3:28:15 AM12/10/10
to
Wrong list, perhaps, but how about a temporary ISPF table?

--
Andy Styles

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

bye,
andi

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.


______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

Grant Ward Able

unread,
Dec 10, 2010, 5:57:32 AM12/10/10
to
Lizette - what I do isnt the most elegant solution perhaps, but it works!
Might not work well for very large numbers of records though.

"ALLOC FI(MQDEF) DA("dsnu") SHR REUSE" /* pds(memname) */
"execio * diskr MQDEF (stem abc. finis" /* read all existing stmts */
j = abc.0
do i = 1 to def.0 /* append all new stmts to end of existing ones */

j = j + 1
abc.j = def.i
abc.0 = j
end
"execio 0 diskw MQDEF (OPEN FINIS" /* empty it! */
"execio * diskw MQDEF (stem abc. finis" /* write all data back */
"FREE FI(MQDEF)"


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

No trees were killed in the sending of this message, but a large number of
electrons were severely disturbed.

The views I have expressed on this website/service are my own personal
views, and are not endorsed or supported by, and do not necessarily
express or reflect, the views, positions or strategies of my employer.

Lizette Koehler <star...@MINDSPRING.COM>
Sent by: TSO REXX Discussion List <TSO-...@VM.MARIST.EDU>
10/12/2010 02:07
Please respond to


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


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

Lizette

<BR>_____________________________________________________________
<FONT size=2><BR>
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.</FONT>

Paul Gilmartin

unread,
Dec 10, 2010, 11:06:24 AM12/10/10
to
On Dec 9, 2010, at 16:33, Lizette Koehler wrote:

> Okay, I have been trying to get this one little snippet of code working and
> for some reason, it escapes me. If I execute this once per day I am good.
> But if done multiple times in a day, the dataset only has the entries from
> the last run.
>

My test case:

/* Rexx */ signal on novalue; /*
Doc: Does disp(MOD) really work?
*/
trace Err
RC = SYSCALLS( 'ON' )

C = ' catalog'
do I = 1 to 10
RC = BPXWDYN( 'alloc dd(X) mod'C 'DSN('userid()'.TEMP.MODTEST) reuse msg(WTP)' )
C = ''
L.1 = 'Line:' right( I, 2 ) date() time()
address 'MVS' 'EXECIO 1 DISKW X (finis stem L.'
address 'SYSCALL' 'sleep 1'; end
RC = BPXWDYN( 'free dd(X) msg(WTP)' )

address 'SH' 'set -x; cp "//'''userid()'.TEMP.MODTEST''" /dev/fd/1'
RC = BPXWDYN( 'alloc dd(X) old delete DSN('userid()'.TEMP.MODTEST) reuse msg(WTP)' )
RC = BPXWDYN( 'free dd(X) msg(WTP)' )
return( RC )

... and the output, which does not exhibit the problem:

user@MVS 30$ modtest
/bin/sh 0 + cp //'user.TEMP.MODTEST' /dev/fd/1
Line: 1 10 Dec 2010 08:58:44
Line: 2 10 Dec 2010 08:58:47
Line: 3 10 Dec 2010 08:58:48
Line: 4 10 Dec 2010 08:58:50
Line: 5 10 Dec 2010 08:58:52
Line: 6 10 Dec 2010 08:58:54
Line: 7 10 Dec 2010 08:58:56
Line: 8 10 Dec 2010 08:58:57
Line: 9 10 Dec 2010 08:58:59
Line: 10 10 Dec 2010 08:59:01

-- gil

Paul Gilmartin

unread,
Dec 10, 2010, 11:06:52 AM12/10/10
to
On Dec 10, 2010, at 01:08, Andreas Fischer wrote:

> just being curious now... i use the stack when calling functions that will
> return an unknown number of elements, example giving, i wrote a function
> that uses the catalog search interface that will queue the matching
> catalog entries in the stack and just return the number of elements in the
> stack. same thing with racf stuff like determing data set profiles or
> connected userids.
>
> any suggestions how to avoid the stack and do it smarter? i thought myself
> it's more useful than returning endless strings and parse them in the main
> program then.
>

Does it not work to use "OUTTRAP STEM." and find the number of
elements in STEM.0?

David S Speake

unread,
Dec 10, 2010, 12:50:17 PM12/10/10
to
Lizette,

Where is your FREE command?

Does it still malfunction after a logoff/logon?

From Chicago Soft's * MVS/QuickRef 7.0 *

------------- V=IBM P=TSO/SYSHELP R=V3R11M0 I=ALLOCATE D=M -----

NOTE - DATA SETS ALLOCATED REMAIN ALLOCATED UNTIL LOGOFF OR

FREED BY FREE COMMAND. NO PERMANENT CONNECTION EXISTS

David.Speake

David....@bcbssc.com

(803)-264-8003

adrianstern

unread,
Dec 11, 2010, 6:23:34 AM12/11/10
to
On Dec 10, 6:50 pm, David.Spe...@BCBSSC.COM (David S Speake) wrote:
> Lizette,
>
> Where is your FREE command?
>
> Does it still malfunction after a logoff/logon?
>
> From Chicago Soft's * MVS/QuickRef 7.0 *
>
> ------------- V=IBM P=TSO/SYSHELP R=V3R11M0 I=ALLOCATE D=M -----
>
> NOTE     - DATA SETS ALLOCATED REMAIN ALLOCATED UNTIL LOGOFF OR
>
>            FREED BY FREE COMMAND. NO PERMANENT CONNECTION EXISTS
>
> David.Speake
>
> David.Spe...@bcbssc.com
> send email to LISTS...@VM.MARIST.EDU with the message: INFO TSO-REXX

>
> ----------------------------------------------------------------------
> For TSO-REXX subscribe / signoff / archive access instructions,
> send email to LISTS...@VM.MARIST.EDU with the message: INFO TSO-REXX- Hide quoted text -
>
> - Show quoted text -

first of all there's no problem at all using the stack - and writing
it to a file is never a problem either - god knows what the people wuo
denigrate it have done
modding a file is no problem either - done it many times; but you must
make sure it actually exists before the exec is run if you're getting
this result - or if you yourself are deleting it in the beginning or
end of the exec - or in another exec.
are you running on-line or in batch? looks like on-line, but in batch
you may have the wrong disp
is the ddname unique? could some other activity allocate the file shr?

Jeremy Nicoll - ls tsrx

unread,
Dec 13, 2010, 6:56:44 PM12/13/10
to
Lizette Koehler <star...@MINDSPRING.COM> wrote:

> Okay, I have been trying to get this one little snippet of code working
> and for some reason, it escapes me. If I execute this once per day I am
> good. But if done multiple times in a day, the dataset only has the
> entries from the last run.
>
>
>
> I do the following
>
>
>
> Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD "

but you don't appear to check the rc so don't know if it actually gets
allocated...


> Some code to queue data then
>
>
>
> "EXECIO " QUEUED() " DISKW PDSM1A(FINIS "

and what's the rc from this?

And is that trailing "A" on the ddname a typo?


> Each time the MOD acts like OLD. Am I missing something??

Error checking?


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

Sebastian Welton

unread,
Dec 14, 2010, 2:17:58 AM12/14/10
to
I have a REXX routine which gets called multiple (hundreds in fact) times a day and over very many days which updates both sequential datasets and a PDS so maybe my code extract might help:

First off I do a check to see if the dataset is allocated, i.e for the PDS:

dsnx = Sysdsn("'"jobsdsn"'")

x = Outtrap('al.')

If dsnx = 'OK' Then Do

Say 'CATLOG JOBS dataset' jobsdsn 'already exists'

End

Else Do

'ALLOC FI(JOBS) UNIT(SYSDA) NEW CYLINDERS SPACE(30,30)' ,

'LRECL(80) RECFM(F B) BLKSIZE(6160) DIR(600) DSORG(PO)' ,

'DA('"'"jobsdsn"'"')'

'FREE FI(JOBS)'

End

x = Outtrap('OFF')

And for the sequnetial:

...
'ALLOC FI(REPORT) DA('"'"repdsn"'"')' ,

'NEW CATALOG UNIT(SYSDA) TRACKS' ,

'SPACE(95 95) LRECL(255) RECFM(F B) DSORG(PS)'

'FREE FI(REPORT)'
...

Next up I write out my data. For the PDS I just 'Queue' all the statements:

x = Outtrap('al.')

"ALLOC FI(JOBS) SHR REUSE DA('"jobsdsn"("memname")')"

x = Outtrap('OFF')
...
Queue '//PGM1 EXEC PGM=IDCAMS,COND=(0,NE,STEP1)'

Queue '//SYSPRINT DD SYSOUT=X'

Queue '//SYSIN DD *'
...
x = Outtrap('al.')

'EXECIO * DISKW JOBS (FINIS'

'FREE FI(JOBS)'

'DELSTACK'

x = Outtrap('OFF')

The sequential datasets are slightly different where I use a counter:

...
t = t + 1

text.t = 'Jobs dataset is' jobsdsn
...
'ALLOC FI(REPORT) DA('"'"repdsn"'"') MOD'

'EXECIO' t 'DISKW REPORT (OPEN FINIS STEM TEXT.'
...
x = Outtrap('fre.')

'FREE FI(JOBS)'

'FREE FI(REPORT)'

x = Outtrap('OFF')

Hope that helps in some way...

--

MfG / Best Regards

Sebastian Welton

IBM zSeries Technical Solutions Consultant EMEA

Mosley, George

unread,
Dec 14, 2010, 11:23:55 AM12/14/10
to
Somewhere along the way, I picked up this little gem of coding:

disp.0 = 'NEW' /* Used in ALLOCs */
disp.1 = 'MOD' /* ...or SHR */
...
tempstat = Sysdsn("'"DS_Name"'") = "OK"
"ALLOC F("DD_Name") DA('"DS_Name"') DATACLAS(FB80) REUSE" disp.tempstat
IF RC > 0 THEN
DO
zerrsm = ' '
zerrlm = 'Unable to Allocate ...'
"SETMSG MSG(ISRZ003)"
END

George (x7327)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Jeremy Nicoll - ls tsrx
Sent: Monday, December 13, 2010 3:56 PM
To: TSO-...@VM.MARIST.EDU
Subject: Re: How to MOD a dataset with EXECIO

Lizette Koehler <star...@MINDSPRING.COM> wrote:

> Okay, I have been trying to get this one little snippet of code
> working and for some reason, it escapes me. If I execute this once
> per day I am good. But if done multiple times in a day, the dataset
> only has the entries from the last run.
>
>
>
> I do the following
>
>
>
> Address TSO "ALLOC DD(PDSM1) DA('"PDSMSYM"') MOD "
> Some code to queue data then
>
>
>
> "EXECIO " QUEUED() " DISKW PDSM1A(FINIS "
> Each time the MOD acts like OLD. Am I missing something??
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions, send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

Mosley, George

unread,
Dec 14, 2010, 11:37:18 AM12/14/10
to
Sorry, spacing was off...

George (x7327)

Robert Zenuk

unread,
Dec 14, 2010, 11:52:41 AM12/14/10
to
Interesting... I had never seen the "something = functioncall(parms) =
'value'" syntax in REXX. I tried a few examples using time and left and it
seems to work. What are the rules? Is it documented?

I guess it saves a couple lines of "IF" logic, but is somewhat obscure...
I would think the following would be easier to read and follow requiring
only 1 more line of code...

if sysdsn("'"DS_Name"'") = 'OK' then
disp = 'MOD'
else
disp = 'NEW'

At first glance, I believe using a non-standard approach like this and
with stems forces support to the most advanced REXX developers to first
interpret what is being done then work on the code. But, I will think about it
some more before I pass judgement. Any other examples out there of using
this technique to help sway my opinion?

My two cents,

Rob


In a message dated 12/14/2010 9:23:47 A.M. US Mountain Standard Time,

Farley, Peter x23353

unread,
Dec 14, 2010, 12:07:37 PM12/14/10
to
> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On Behalf
> Of Robert Zenuk
> Sent: Tuesday, December 14, 2010 11:52 AM
> To: TSO-...@vm.marist.edu
> Subject: Re: How to MOD a dataset with EXECIO
>
> Interesting... I had never seen the "something = functioncall(parms) =
> 'value'" syntax in REXX. I tried a few examples using time and left and
> it
> seems to work. What are the rules? Is it documented?
>
> I guess it saves a couple lines of "IF" logic, but is somewhat obscure...
> I would think the following would be easier to read and follow requiring
> only 1 more line of code...
>
> if sysdsn("'"DS_Name"'") = 'OK' then
> disp = 'MOD'
> else
> disp = 'NEW'
>
> At first glance, I believe using a non-standard approach like this and
> with stems forces support to the most advanced REXX developers to first
> interpret what is being done then work on the code. But, I will think
> about it some more before I pass judgement. Any other examples out
> there of using this technique to help sway my opinion?

That syntax is just assigning a Boolean (logical) value (i.e., 0 or 1) to the leftmost variable on the line. The second "=" is not assignment but comparison, so a meta-description of that code line would be

variable = conditional-expression

Personally, I would code such a line as:

variable = (conditional-expression)

to emphasize the nature of the conditional-expression, but that's just my preference.

I have often used that syntax when "conditional-expression" involves an expensive Rexx operation (like an external function call) and the expression needs to be tested more than once.

For your version, I would keep the line count down by coding it as:

if sysdsn("'"DS_Name"'") = 'OK' then disp = 'MOD'
else disp = 'NEW'

Maybe I qualify as an "expert" (I've never really thought so), but the interpretation of the code as George presented it was obvious to me at first reading. Maybe I've just been coding for too many years to be surprised by "interesting" techniques any more.

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.

Pinnacle

unread,
Dec 14, 2010, 12:12:55 PM12/14/10
to

Peter,

You beat me to it by 2 mins. It's a boolean value, but I would have coded
it your way. Easier to read and debug by far, and I would bet more
efficient as well.

Regards,
Tom Conley

Vitonis, Tony

unread,
Dec 14, 2010, 12:15:43 PM12/14/10
to
I use a hand-rolled ternary function for this sort of thing:

DataSetExists = ( SYSDSN("'"DS_Name"'") = "OK" )
Disp = IFF(DataSetExists, "MOD", "NEW")

The arguments to IFF are evaluated before the function is invoked - no
short-circuiting.

Tony

-----Original Message-----
From: Farley, Peter x23353

> if sysdsn("'"DS_Name"'") = 'OK' then
> disp = 'MOD'
> else
> disp = 'NEW'

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

Mosley, George

unread,
Dec 14, 2010, 12:25:11 PM12/14/10
to
You got me on that one, Tony. What exactly is "IFF"?

George

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Vitonis, Tony
Sent: Tuesday, December 14, 2010 9:14 AM
To: TSO-...@VM.MARIST.EDU
Subject: Re: How to MOD a dataset with EXECIO

------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

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

Bey Abdel H

unread,
Dec 14, 2010, 12:28:36 PM12/14/10
to
DIGEST

Binyamin Dissen

unread,
Dec 14, 2010, 12:31:31 PM12/14/10
to
On Tue, 14 Dec 2010 17:24:54 +0000 "Mosley, George" <George...@ICBC.COM>
wrote:

:>You got me on that one, Tony. What exactly is "IFF"?

Probably

IFF: IF ARG(1) THEN RETURN ARG(2) ELSE RETURN ARG(3)

And

Disp = IFF((SYSDSN("'"DS_Name"'") = "OK"), "MOD", "NEW")

is a lot clearer IMHO.


:>-----Original Message-----

--
Binyamin Dissen <bdi...@dissensoftware.com>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

Vitonis, Tony

unread,
Dec 14, 2010, 12:43:00 PM12/14/10
to
It's the hand-rolled ternary function I mentioned. (I meant to type the
name as "IIF"; sorry. IFF looks too much like "if and only if".) The
function in its entirety:

/* REXX */ IF ARG(1) THEN RETURN ARG(2) ; ELSE RETURN ARG(3)

I like cramming simple external functions onto a single line. =)

-----Original Message-----
From: Mosley, George

You got me on that one, Tony. What exactly is "IFF"?

George

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

I use a hand-rolled ternary function for this sort of thing:

DataSetExists = ( SYSDSN("'"DS_Name"'") = "OK" )

Disp = IIF(DataSetExists, "MOD", "NEW") [Edit: Corrected the
function name]

The arguments to IIF are evaluated before the function is invoked - no

Vitonis, Tony

unread,
Dec 14, 2010, 1:03:33 PM12/14/10
to
Interesting. My opinion is the opposite. I think "DataSetExists" is
clearer because it conveys the intent behind the decision that's being
made. The particular syntax of the existence checking is irrelevant to
the decision. To imbed it in the IIF statement is to add to the
statement's cognitive load.

You could have the best of both with something like:

Disp = IIF(DataSetExists(DS_Name), "MOD", "SHR")

...

DataSetExists: RETURN ( SYSDSN("'"ARG(1)"'") = "OK" )

As shown, the DataSetExists function is suboptimal. It could be made
more verbose to make its intent more clear; it could be externalized for
use in multiple execs; it could take into account the PREFIX/NOPREFIX
setting in the user's TSO profile; etc.

Anyway, to externalize the check is to hide the details and allow for
reuse, good practices both. If we find later that we want or have to do
the check a different way, we need change it in only one place - of
course, keeping in mind the whole time that premature optimization is
the root of all evil.

Let the religious wars begin.

Tony

Mickey

unread,
Dec 14, 2010, 1:21:08 PM12/14/10
to
Whereas I think a simple

If SYSDSN(somedataset) = 'OK' Then
"ALLOC (Fxxx) DA('xxx.zzz.yyy') MOD REU"
Else
"ALLOC (Fxxx) DA('xxx.zzz.yyy') New SomeDsorgIno"


will do for me :)

Mickey


--------------------------------------------------
From: "Vitonis, Tony" <Tony.V...@CA.COM>
Sent: Tuesday, December 14, 2010 1:01 PM
To: <TSO-...@VM.MARIST.EDU>
Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO

Vitonis, Tony

unread,
Dec 14, 2010, 1:26:49 PM12/14/10
to
Of course that works just fine. =) But if I code something twice, I find
myself immediately coding it again, in a way that I hope will make it
easier and better to code thereafter. This is typical of programmers,
hm? The non-Daily-WTF kind.

Tony

-----Original Message-----
From: Mickey

Whereas I think a simple

If SYSDSN(somedataset) = 'OK' Then
"ALLOC (Fxxx) DA('xxx.zzz.yyy') MOD REU"
Else
"ALLOC (Fxxx) DA('xxx.zzz.yyy') New SomeDsorgIno"


will do for me :)

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

Robert Zenuk

unread,
Dec 14, 2010, 2:06:10 PM12/14/10
to
This is a response to all the responses. When all else fails run a
benchmark...

Without a doubt this is personal preference. I don't consider myself an
expert either and I was able to figure it out, but this is not a commonly
used rexx technique. I guess this goes back to the adage of writing good
code versus clever code. When you are writing for personal use, then all bets
are off. I have tons of clever techniques I have tried and decided did
not belong in production code. In production code, the KISS method is most
likely to keep you off 3AM calls when something fails and nobody can
figure out the code. However, I will admit, there are techniques that simply
save too much coding and/or offer extreme performance benefits. The use of
booleans in stems is one of those when dealing with large sparse arrays. As
for the number of lines, I have never been worried about the number of
lines except when performance of those lines becomes an issue. From a coding
style perspective I tend to "stretch" my IF statements across multiple
lines just in case the THEN becomes a THEN DO.. END. I haven't been on a
machine in years where the difference between an IF on 2 lines was more
efficient than an IF on 4 lines. In fact to prove that I just ran a little test...
I also included the boolean alternative. I used the time() function to
keep it an apples to apples comparison.

My opinion is the difference in this is insignificant...

000001 call iftest1 10
000002 call iftest2 10
000003 call boolck0 10
000004 call boolck1 10
000005 call iftest1 100
000006 call iftest2 100
000007 call boolck0 100
000008 call boolck1 100
000009 call iftest1 1000
000010 call iftest2 1000
000011 call boolck0 1000
000012 call boolck1 1000
000013 call iftest1 10000
000014 call iftest2 10000
000015 call boolck0 10000
000016 call boolck1 10000
000017 call iftest1 100000
000018 call iftest2 100000
000019 call boolck0 100000
000020 call boolck1 100000
000021 call iftest1 1000000
000022 call iftest2 1000000
000023 call boolck0 1000000
000024 call boolck1 1000000
000025 exit 0
000026 iftest1: arg count
000027 x = time('r')
000028 do count
000029 if time() > 0 then answer = 'YES'
000030 else answer = 'NO'
000031 end
000032 say '2 line IF' count 'loops:' time('e')
000033 return
000034 iftest2: arg count
000035 x = time('r')
000036 do count
000037 if time() > 0 then
000038 answer = 'YES'
000039 else
000040 answer = 'NO'
000041 end
000042 say '4 line IF' count 'loops:' time('e')
000043 return
000044 boolck0: arg count
000045 x = time('r')
000046 do count
000047 x = time() < 0
000048 answer = x
000049 end
000050 say 'Boolean 0' count 'loops:' time('e')
000051 return
000052 boolck1: arg count
000053 x = time('r')
000054 do count
000055 x = time() > 0
000056 answer = x
000057 end
000058 say 'Boolean 1' count 'loops:' time('e')
000059 return

Results:

2 line IF 10 loops: 0.000039
4 line IF 10 loops: 0.000033
Boolean 0 10 loops: 0.000063
Boolean 1 10 loops: 0.000033
2 line IF 100 loops: 0.000309
4 line IF 100 loops: 0.000549
Boolean 0 100 loops: 0.000594
Boolean 1 100 loops: 0.000428
2 line IF 1000 loops: 0.004488
4 line IF 1000 loops: 0.003112
Boolean 0 1000 loops: 0.003942
Boolean 1 1000 loops: 0.003425
2 line IF 10000 loops: 0.034859
4 line IF 10000 loops: 0.037957
Boolean 0 10000 loops: 0.029135
Boolean 1 10000 loops: 0.050950
2 line IF 100000 loops: 0.356839
4 line IF 100000 loops: 0.377404
Boolean 0 100000 loops: 0.332617
Boolean 1 100000 loops: 0.354190
2 line IF 1000000 loops: 3.343181
4 line IF 1000000 loops: 3.197640
Boolean 0 1000000 loops: 3.325473
Boolean 1 1000000 loops: 3.215539


Here is the actual technique in question...

000001 dsn = my.jcl
000002 call iftest1 10
000003 call iftest2 10
000004 call boolck1 10
000005 call boolck0 10
000006 call iftest1 100
000007 call iftest2 100
000008 call boolck1 100
000009 call boolck0 100
000010 call iftest1 1000
000011 call iftest2 1000
000012 call boolck1 1000
000013 call boolck0 1000
000014 call iftest1 10000
000015 call iftest2 10000
000016 call boolck1 10000
000017 call boolck0 10000
000018 call iftest1 100000
000019 call iftest2 100000
000020 call boolck1 100000
000021 call boolck0 100000
000022 call iftest1 1000000
000023 call iftest2 1000000
000024 call boolck1 1000000
000025 call boolck0 1000000
000026 exit 0
000027 iftest1: arg count
000028 x = time('r')
000029 do count
000030 if sysdsn(dsn) = 'OK' then disp = 'MOD'
000031 else disp = 'NEW'
000032 end
000033 say '2 line IF' count 'loops:' time('e')
000034 return
000035 iftest2: arg count
000036 x = time('r')
000037 do count
000038 if sysdsn(dsn) = 'OK' then
000039 disp = 'MOD'
000040 else
000041 disp = 'NEW'
000042 end
000043 say '4 line IF' count 'loops:' time('e')
000044 return
000045 boolck1: arg count
000046 x = time('r')
000047 do count
000048 disp.0 = 'NEW'
000049 disp.1 = 'MOD'
000050 y = sysdsn(dsn) = 'OK'
000051 disp = disp.y
000052 end
000053 say 'Boolean 1' count 'loops:' time('e')
000054 return
000055 boolck0: arg count
000056 dsn = 'XXX.XXX'
000057 x = time('r')
000058 do count
000059 disp.0 = 'NEW'
000060 disp.1 = 'MOD'
000061 y = sysdsn(dsn) = 'OK'
000062 disp = disp.y
000063 end
000064 say 'Boolean 0' count 'loops:' time('e')
000065 return

I canceled this one after the 10K loops since it was taking so long with
the actual catalog checks...

2 line IF 10 loops: 0.083265
4 line IF 10 loops: 0.070373
Boolean 1 10 loops: 0.068867
Boolean 0 10 loops: 0.067225
2 line IF 100 loops: 0.867322
4 line IF 100 loops: 0.828794
Boolean 1 100 loops: 0.800526
Boolean 0 100 loops: 0.854536
2 line IF 1000 loops: 9.458147
4 line IF 1000 loops: 8.549017
Boolean 1 1000 loops: 9.077987
Boolean 0 1000 loops: 9.576846
2 line IF 10000 loops: 92.039735
4 line IF 10000 loops: 112.807368
Boolean 1 10000 loops: 102.295000
Boolean 0 10000 loops: 97.244225

With the SYSDSN catalog access involved the numbers changed and were
greatly slowed down due to the I/O. The catalogs are using ECS.

I don't think the results of either test prove the technique is more or
less efficient nor is the difference of a 2 line IF versus a 4 line IF... In
my mind we are back to personal preference and best practices coding style
for personal versus production code...

Well, that was a fun diversion... Now I have to get back to work...

Rob

In a message dated 12/14/2010 10:07:39 A.M. US Mountain Standard Tim,
Peter....@BROADRIDGE.COM writes:

> -----Original Message-----
> From: TSO REXX Discussion List [mailto:TSO-...@vm.marist.edu] On Behalf
> Of Robert Zenuk
> Sent: Tuesday, December 14, 2010 11:52 AM
> To: TSO-...@vm.marist.edu

> Subject: Re: How to MOD a dataset with EXECIO
>

> Interesting... I had never seen the "something = functioncall(parms) =
> 'value'" syntax in REXX. I tried a few examples using time and left and
> it
> seems to work. What are the rules? Is it documented?
>
> I guess it saves a couple lines of "IF" logic, but is somewhat
obscure...
> I would think the following would be easier to read and follow requiring
> only 1 more line of code...
>

> if sysdsn("'"DS_Name"'") = 'OK' then
> disp = 'MOD'
> else
> disp = 'NEW'
>

> At first glance, I believe using a non-standard approach like this and
> with stems forces support to the most advanced REXX developers to first
> interpret what is being done then work on the code. But, I will think
> about it some more before I pass judgement. Any other examples out
> there of using this technique to help sway my opinion?

That syntax is just assigning a Boolean (logical) value (i.e., 0 or 1) to
the leftmost variable on the line. The second "=" is not assignment but
comparison, so a meta-description of that code line would be

variable = conditional-expression

Personally, I would code such a line as:

variable = (conditional-expression)

to emphasize the nature of the conditional-expression, but that's just my
preference.

I have often used that syntax when "conditional-expression" involves an
expensive Rexx operation (like an external function call) and the expression
needs to be tested more than once.

For your version, I would keep the line count down by coding it as:

if sysdsn("'"DS_Name"'") = 'OK' then disp = 'MOD'
else disp = 'NEW'

Maybe I qualify as an "expert" (I've never really thought so), but the


interpretation of the code as George presented it was obvious to me at first
reading. Maybe I've just been coding for too many years to be surprised by
"interesting" techniques any more.

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.

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

Jeremy Nicoll - ls tsrx

unread,
Dec 14, 2010, 4:59:30 PM12/14/10
to
"Vitonis, Tony" <Tony.V...@CA.COM> wrote:

> I use a hand-rolled ternary function for this sort of thing:
>
> DataSetExists = ( SYSDSN("'"DS_Name"'") = "OK" )

It's a side-issue, but you need to be more careful.

You can get return values other than "OK" from SYSDSN for datasets that
exist.

From notes I wrote for myself sometime in the 1990s:


Logic problems can be caused by using SYSDSN badly. It is possible
that a routine expecting OK (ie: member exists) will get some other
value: eg DATASET UNAVAILABLE even if the member does exist. Basing
code on test of (in)equality with "OK" can be wrong!!

When sysdsn is used to enquire about a tape dataset if the dataset is
cataloged you'd normally get "VOLUME NOT ON SYSTEM". If the dataset
is allocated by another job, but not open, you still get this message.
When a job running on another system has opened the dataset you still
get that message. Unfortunately when a job running on the SAME system
has opened it you get: ERROR PROCESSING REQUESTED DATASET.


I asked IBM about this. They said that the ERROR ... message
is coded as a catch-all message for all the bad return codes from SVC
99. If you get this message you cannot tell what the snag is. They
admit that sysdsn is 'quick & dirty' compared, say, with listdsi.

LISTDSI always says retcode 16 (tape not supported) but it also gives
a reason code: 8 is 'not on dasd' while 16 is 'not cataloged'.

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

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

Vitonis, Tony

unread,
Dec 14, 2010, 5:19:14 PM12/14/10
to
I wrote that line under the admittedly shallow assumption that comparing
to "OK" was good enough for the purposes of the conversation. But your
point is taken, and I think is in fact an argument for centralizing
broad queries like this.

If DataSetExists (or DSEXISTS or whatever) were in a single place, all
of its callers would benefit from a logic change that takes into account
what you've mentioned. They'd all remain exactly as readable, too.
Neither would be the case if SYSDSN("'"DS_Name"'") = "OK" were
explicitly coded everywhere the check was being done.

Tony

"Vitonis, Tony" <Tony.V...@CA.COM> wrote:

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

adrianstern

unread,
Dec 15, 2010, 5:20:40 AM12/15/10
to
On Dec 14, 11:19 pm, Tony.Vito...@CA.COM (Vitonis, Tony) wrote:
> I wrote that line under the admittedly shallow assumption that comparing
> to "OK" was good enough for the purposes of the conversation. But your
> point is taken, and I think is in fact an argument for centralizing
> broad queries like this.
>
> If DataSetExists (or DSEXISTS or whatever) were in a single place, all
> of its callers would benefit from a logic change that takes into account
> what you've mentioned. They'd all remain exactly as readable, too.
> Neither would be the case if SYSDSN("'"DS_Name"'") = "OK" were
> explicitly coded everywhere the check was being done.
>
> Tony
>
> -----Original Message-----
> From: Jeremy Nicoll - ls tsrx
>
> send email to LISTS...@VM.MARIST.EDU with the message: INFO TSO-REXX

damn you guys like to make life difficult
allocating a dataset "NEW" and checking the return code will tell you
all you need to know - and if it's not supposed to exist then you'll
be satisfied. on the other hand you can allocate "SHR" and check that
return code if it's supposed to already exist; allocating "MOD" will
give you the dataset you want if it exists or create it if it doesn't
- and you'll probably run into space problems if you don't allocate
any.

readdressing the original problem - it's illogical to use apend for
adding to a pds member since the allocation is for the dataset and
append makes no sense for a pds member - so you imo should not be able
to just add lines to a member that way - don't have an assignment
right now so can't test the results

in general it's no big deal to read in a whole member, add lines and
write back - but remember that this kind of access will delete ispf
statistics if there were any and you wanted to keep them - but then
you can use lmxxx commands under ispf instead can't you?

Sebastian Welton

unread,
Dec 15, 2010, 6:30:48 AM12/15/10
to
>> I use a hand-rolled ternary function for this sort of thing:
>>
>> DataSetExists = ( SYSDSN("'"DS_Name"'") = "OK" )
>
>It's a side-issue, but you need to be more careful.
>
>You can get return values other than "OK" from SYSDSN for datasets that
>exist.

Correct. I like to use x = Sysdsn('dataset_name')

and then I can evaluate x and if not OK either call an error routine or create the dataset depending on what the REXX procedure is meant to be doing.

--

MfG / Best Regards

Sebastian Welton

IBM zSeries Technical Solutions Consultant EMEA

Fon: +49 (0) 6151 307144
Fax: +49 (0) 6151 307144
Mobile: +49 (0) 171 8880522

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,

send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Bob Bridges

unread,
Dec 15, 2010, 7:58:14 AM12/15/10
to
Just to add options, when I do it this way it'd probably be:

If SYSDSN(somedataset) = 'OK' Then opts='MOD REU'
else opts='New SomeDsorgIno'
"ALLOC (Fxxx) DA('xxx.zzz.yyy')" opts

---
Bob Bridges, rhb...@attglobal.net, cell 336 382-7313
work bob.b...@libertymutual.com, 317 581-6487

/* When weeding, the best way to make sure you're removing a weed and not a
valuable plant is to pull on it. If it comes out of the ground easily, it's
a valuable plant. */

-----Original Message-----
From: Mickey
Sent: Tuesday, December 14, 2010 13:21

Whereas I think a simple

If SYSDSN(somedataset) = 'OK' Then
"ALLOC (Fxxx) DA('xxx.zzz.yyy') MOD REU"
Else
"ALLOC (Fxxx) DA('xxx.zzz.yyy') New SomeDsorgIno"

will do for me :)

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

Bob Bridges

unread,
Dec 15, 2010, 7:59:58 AM12/15/10
to
I have nothing against SYSDSN for quick-and-dirty checks, but habitually
nowadays I tend to rely on DSDD, a homegrown function that tells me whether
a string I pass it is the name of an existing DS, or an allocated DD, or of
course both or neither. It uses LISTDSI, and I have cause to tweak the
subsequent logic from time to time but here's how it lies currently:

/* Is it a DSN? */
fds:
call listdsi dx
sysreason=sysreason+0
if result=16 & wordpos(sysreason,'1 5 25')=0,
then say 'DSDD: FDS' dx result sysreason
return result<16 | sysreason=25

/* Get LISTDSI. Warning: LISTDSI returns RC=16, sysreason=2 both if
DD is missing and if it's allocated to a GDG(+1)! */
fdd:
call listdsi dx 'FILE'
sysreason=sysreason+0
if result=16 & wordpos(sysreason,'1 2 3 27 28')=0,
then say 'DSDD: FDD' dx result sysreason
return result<16 | wordpos(sysreason,'3 27')>0

The SAY statements are just my notification that a new SYSREASON has cropped
up that I haven't encountered before. Otherwise, basically the above says
that a DS exists if RESULT isn't 16, or even if it is if SYSREASON is 25.
For the DD test the SYSREASON exceptions are 3 and 27.

/* Even when the pop stars of the past moved around, they stuck to movements
that did not require superb physical conditioning, or even a central nervous
system. A good example is a dance called "The Freddie", which was
popularized briefly in 1965 by Freddie and the Dreamers, a British Twit
Invasion band that, when it performed this dance, strongly resembled a group
of men failing a roadside sobriety test. -Dave Barry, 2001 */

-----Original Message-----
From: Jeremy Nicoll - ls tsrx

Sent: Tuesday, December 14, 2010 16:59

It's a side-issue, but you need to be more careful. You can get return
values other than "OK" from SYSDSN for datasets that exist.

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

Bob Bridges

unread,
Dec 15, 2010, 8:00:54 AM12/15/10
to
I'm with Peter Farley and others: I do this freely enough, but I always use
the extra parens to make the logic clearer to Those Who Come After.

/* Easy credit terms available. -Satan */

-----Original Message-----
From: Robert Zenuk
Sent: Tuesday, December 14, 2010 11:52

Interesting... I had never seen the "something = functioncall(parms) =
'value'" syntax in REXX. I tried a few examples using time and left and it
seems to work. What are the rules? Is it documented?

I guess it saves a couple lines of "IF" logic, but is somewhat obscure...
I would think the following would be easier to read and follow requiring
only 1 more line of code...

if sysdsn("'"DS_Name"'") = 'OK' then
disp = 'MOD'
else
disp = 'NEW'

--- In a message dated 12/14/2010 9:23:47 A.M. US Mountain Standard Time,
George...@ICBC.COM writes:

tempstat = Sysdsn("'"DS_Name"'") = "OK"

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

Robert Zenuk

unread,
Dec 15, 2010, 11:22:07 AM12/15/10
to
This is a nice tidbit. While I have used wordpos a gazillion times it
never occurred to me to use it with the multiple sysreasons from LISTDSI. In
my DDCHECK routine I accept/ignore the sysreason values 3, 8, 12, 22 and 27
(tape, SYSOUT, VSAM and VIO) from LISTDSI (with other checks later to
confirm). So, this will nicely streamline my IF statement.

Thanks,

Rob

In a message dated 12/15/2010 5:58:38 A.M. US Mountain Standard Time,
rhb...@ATTGLOBAL.NET writes:

if result=16 & wordpos(sysreason,'1 5 25')=0,

Mickey

unread,
Dec 15, 2010, 2:49:23 PM12/15/10
to
I used to, but I just find I like it better with both statements in the
code, in case I want options for one but not for the other.

--------------------------------------------------
From: "Bob Bridges" <rhb...@ATTGLOBAL.NET>
Sent: Wednesday, December 15, 2010 7:58 AM
To: <TSO-...@VM.MARIST.EDU>
Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO

Bob Bridges

unread,
Dec 15, 2010, 8:03:21 PM12/15/10
to
You're welcome, Rob - but don't forget the previous statement
"sysreason=sysreason+0", because otherwise you're looking through "3 8 12 22
27" for the value "00000022", and it won't find it. Ok, I forget exactly
how many zeroes, but it was a few.

Come to think of it, though, I could have been doing it this way all along
and saved myself the extra line:

if result=16 & wordpos(sysreason+0,'1 5 25')=0 then....

/* Wink at small faults; remember thou hast great ones. -Poor Richard */

-----Original Message-----
From: Robert Zenuk

Sent: Wednesday, December 15, 2010 11:22

This is a nice tidbit. While I have used wordpos a gazillion times it
never occurred to me to use it with the multiple sysreasons from LISTDSI.
In my DDCHECK routine I accept/ignore the sysreason values 3, 8, 12, 22 and
27 (tape, SYSOUT, VSAM and VIO) from LISTDSI (with other checks later to
confirm). So, this will nicely streamline my IF statement.

--- In a message dated 12/15/2010 5:58:38 A.M. US Mountain Standard Time,

Mickey

unread,
Dec 16, 2010, 9:51:27 AM12/16/10
to
or...

if result=16 & wordpos((ABS(sysreason),'1 5 25')=0 then

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

Sent: Wednesday, December 15, 2010 8:03 PM


To: <TSO-...@VM.MARIST.EDU>
Subject: Re: [TSO-REXX] How to MOD a dataset with EXECIO

> You're welcome, Rob - but don't forget the previous statement

Mosley, George

unread,
May 31, 2011, 5:12:54 PM5/31/11
to
Hello All.

We have a process wherein a Rexx exec launches a started task by issuing a CONSOLE ACTIVATE, a CONSOLE START jobname and a CONSOLE DEACTIVATE. This Rexx code is executing in a batch job and so there may be multiple instances of the same code executing simultaneously.

We had an instance today that involved four of these jobs all executing at approximately the same time. It turned out in this instance that two of the jobs completed successfully and the other two didn't. The two that failed had a message in the job sysout indicating that the CONSOLE ACTIVATE had failed because the CONSOLE was already ACTIVATED.

I don't have a lot of experience with this command but was my understanding that code executing in separate address spaces could ACTIVATE CONSOLE without concern for what's going on in other address spaces.

Does anyone have experience with this. The manual doesn't provide that level of detail.

Thanks.

George Mosley
------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

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

Binyamin Dissen

unread,
May 31, 2011, 5:23:08 PM5/31/11
to
On Tue, 31 May 2011 21:12:06 +0000 "Mosley, George" <George...@ICBC.COM>
wrote:

:>We have a process wherein a Rexx exec launches a started task by issuing a CONSOLE ACTIVATE, a CONSOLE START jobname and a CONSOLE DEACTIVATE. This Rexx code is executing in a batch job and so there may be multiple instances of the same code executing simultaneously.

:>We had an instance today that involved four of these jobs all executing at approximately the same time. It turned out in this instance that two of the jobs completed successfully and the other two didn't. The two that failed had a message in the job sysout indicating that the CONSOLE ACTIVATE had failed because the CONSOLE was already ACTIVATED.

:>I don't have a lot of experience with this command but was my understanding that code executing in separate address spaces could ACTIVATE CONSOLE without concern for what's going on in other address spaces.

:>Does anyone have experience with this. The manual doesn't provide that level of detail.

Look at the NAME keyword.

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

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

Don Imbriale

unread,
May 31, 2011, 5:24:41 PM5/31/11
to
The TSO/E System Programming Command Reference manual contains the
description of the commands you are entering. There can be only one console
with a given name active at one time. Because of the timing of you
commands, you may have more than one with the same name. There is a NAME
parameter on the CONSOLE ACTIVATE command that may help.

- Don Imbriale

On Tue, May 31, 2011 at 5:12 PM, Mosley, George <George...@icbc.com>wrote:

> Hello All.
>
> We have a process wherein a Rexx exec launches a started task by issuing a
> CONSOLE ACTIVATE, a CONSOLE START jobname and a CONSOLE DEACTIVATE. This
> Rexx code is executing in a batch job and so there may be multiple instances
> of the same code executing simultaneously.
>
> We had an instance today that involved four of these jobs all executing at
> approximately the same time. It turned out in this instance that two of the
> jobs completed successfully and the other two didn't. The two that failed
> had a message in the job sysout indicating that the CONSOLE ACTIVATE had
> failed because the CONSOLE was already ACTIVATED.
>
> I don't have a lot of experience with this command but was my understanding
> that code executing in separate address spaces could ACTIVATE CONSOLE
> without concern for what's going on in other address spaces.
>
> Does anyone have experience with this. The manual doesn't provide that
> level of detail.
>
> Thanks.
>
> George Mosley
>

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

Mosley, George

unread,
May 31, 2011, 5:57:08 PM5/31/11
to
Great, will try that.

Thanks Don. Thanks Binyamin.

George (x7327)

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Don Imbriale
Sent: Tuesday, May 31, 2011 2:24 PM
To: TSO-...@VM.MARIST.EDU
------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

Robert Zenuk

unread,
May 31, 2011, 6:44:17 PM5/31/11
to
Whether I am using the CONSOLE command or SDSF/REXX I use the JOB Number as
the CONSOLE ID.

JOBnnnnn or STCnnnnn or TSUnnnnn

This does a good job of insuring uniqueness.

Here is a little chunk of code to get it...

/* rexx */
tcb = storage(21c,4)
jscb = storage(d2x(c2d(tcb)+180),4)
ssib = storage(d2x(c2d(jscb)+316),4)
jobnum = storage(d2x(c2d(ssib)+12),8)
say mvsvar('SYMDEF',JOBNAME) jobnum

Hope this helps,

Rob

In a message dated 5/31/2011 2:24:36 P.M. US Mountain Standard Time,

Mosley, George

unread,
May 31, 2011, 6:57:51 PM5/31/11
to
Thanks, Rob. That's actually the conclusion I'd arrived at.

However, one thing mystifies me a little. The manual shows the NAME PARM for the ACTIVATE and the SYSCMD options but not the DEACTIVATE option. How does it know which Console to deactivate?

George

-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Robert Zenuk
Sent: Tuesday, May 31, 2011 3:43 PM
To: TSO-...@VM.MARIST.EDU
Subject: Re: CONSOLE Command

------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

Mosley, George

unread,
Jun 20, 2011, 1:55:33 PM6/20/11
to
Hello All.

I'm familiar with the following pause processing technique in Rexx (for 10 seconds, for example):

Call syscalls('ON')
Address syscall "sleep" 10
Call syscalls("OFF")

Does anyone know how to achieve the same thing in Clist code?

Thanks.

George

John P Kalinich

unread,
Jun 20, 2011, 2:08:28 PM6/20/11
to
The CBT tape (file 322) has several SLEEP programs that can be used in TSO
CLIST. I use the one by
Hans Joolen, Delft University of Technology, The Netherlands.

Regards,
John K

From: "Mosley, George" <George...@ICBC.COM>

To: TSO-...@vm.marist.edu

Date: 06/20/2011 12:56 PM

Subject: [TSO-REXX] SLEEP


Hello All.

I'm familiar with the following pause processing technique in Rexx (for 10
seconds, for example):

Call syscalls('ON')
Address syscall "sleep" 10
Call syscalls("OFF")

Does anyone know how to achieve the same thing in Clist code?

Thanks.

George

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

Ted MacNEIL

unread,
Jun 20, 2011, 2:47:52 PM6/20/11
to
Look into BPXBATCH.
-
Ted MacNEIL
eama...@yahoo.ca
Twitter: @TedMacNEIL

Don Imbriale

unread,
Jun 20, 2011, 2:50:52 PM6/20/11
to
Why not just call the REXX exec from the CLIST?

- Don Imbriale

On Mon, Jun 20, 2011 at 1:54 PM, Mosley, George <George...@icbc.com>wrote:

> Hello All.
>
> I'm familiar with the following pause processing technique in Rexx (for 10
> seconds, for example):
>
> Call syscalls('ON')
> Address syscall "sleep" 10
> Call syscalls("OFF")
>
> Does anyone know how to achieve the same thing in Clist code?
>
> Thanks.
>
> George
>

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

Mosley, George

unread,
Jun 20, 2011, 3:13:43 PM6/20/11
to
Thanks, Everyone.

Some good options, especially for the future.

For now, I think I'll go with Don's suggestion - easiest and fastest for me to implement.

George
------------------------------------------------------------
This email and any attachments are intended only for the named
recipient and may contain confidential and/or privileged material.
Any unauthorized copying, dissemination or other use by a person
other than the named recipient of this communication is prohibited.
If you received this in error or are not named as a recipient,
please notify the sender and destroy all copies of this email
immediately.

Mosley, George

unread,
Feb 23, 2012, 2:49:54 PM2/23/12
to
Hello List.



This is frustrating! I pull out code I've used dozens of times and now I can't get the DISKW to work.



I must be doing something that's painfully obvious wrong - but I can't see it.



Here's the trace O/P:



5 *-* Address TSO

6 *-* "ALLOC FI(CALLERS) DA('KS7O.TEST.CALLERS') SHR REUSE"

>L> "ALLOC FI(CALLERS) DA('KS7O.TEST.CALLERS') SHR REUSE"

7 *-* "EXECIO 0 DISKW CALLERS (OPEN"

>L> "EXECIO 0 DISKW CALLERS (OPEN"

9 *-* queue 'LV CALLEE APPL OWNR CALLER APPL OWNR'

>L> "LV CALLEE APPL OWNR CALLER APPL OWNR"

10 *-* queue '-- -------- ---- ---- -------- ---- ----'

>L> "-- -------- ---- ---- -------- ---- ----"

11 *-* "EXECIO 2 DISKW CALLERS"

>L> "EXECIO 2 DISKW CALLERS"

+++ RC(1) +++

12 *-* queue ''

>L> ""

13 *-* "EXECIO * DISKW CALLERS (FINIS)"

>L> "EXECIO * DISKW CALLERS (FINIS)"

15 *-* Exit 0

>L> "0"



Thanks.



George

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

This email and any attachments are intended only for the named

recipient and may contain confidential and/or privileged material.

Any unauthorized copying, dissemination or other use by a person

other than the named recipient of this communication is prohibited.

If you received this in error or are not named as a recipient,

please notify the sender and destroy all copies of this email

immediately.







Rob Zenuk

unread,
Feb 23, 2012, 3:04:43 PM2/23/12
to
Does the queued data length exceed the LRECL of the target dataset?

Rob

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

Bodoh John Robert

unread,
Feb 23, 2012, 3:08:25 PM2/23/12
to
What's the LRECL. The data is too long.

John

Mosley, George

unread,
Feb 23, 2012, 3:12:58 PM2/23/12
to
Well, the data in the trace example is 41 characters. The dataset LRECL is 50.

George (#7327)


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Rob Zenuk
Sent: Thursday, February 23, 2012 12:03 PM
To: TSO-...@VM.MARIST.EDU

Don Imbriale

unread,
Feb 23, 2012, 3:28:14 PM2/23/12
to
Since you're writing to the data set, disp of OLD might be needed.
It would be useful to check return codes from the ALLOC and EXECIO.
When closing the file, use a count of 0 rather than *. If a null line has
been put onto the stack, then * might work.

- Don Imbriale

Mosley, George

unread,
Feb 23, 2012, 3:37:56 PM2/23/12
to
OK, found it and face is very red.



I have two datasets, similarly named, it turns out, one with TEMP as MLQ and one with TEST.



I was running with TEST and checking LRECL of TEMP.



It was an LRECL problem after all.



Thanks, everyone.



George





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

From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Don Imbriale

Sent: Thursday, February 23, 2012 12:27 PM

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

Subject: Re: EXECIO
------------------------------------------------------------

This email and any attachments are intended only for the named

recipient and may contain confidential and/or privileged material.

Any unauthorized copying, dissemination or other use by a person

other than the named recipient of this communication is prohibited.

If you received this in error or are not named as a recipient,

please notify the sender and destroy all copies of this email

immediately.

0 new messages