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

How to Test is a File Exists under REXX/MVS

5,585 views
Skip to first unread message

John Saxton

unread,
Jan 29, 1998, 3:00:00 AM1/29/98
to

How can I find out if a file exists under rexx on mvs? I have considered
and tried various iterations of ALLOC and EXECIO. According to the doco
that I read. I thought that ALLOC specified with SHR or OLD would
require that the dataset was already present. Didn't work.

Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
mainframe has confounded me.

Wayne L. Beavers

unread,
Jan 29, 1998, 3:00:00 AM1/29/98
to

I think you want LISTDSI.
--
Wayne L. Beavers mailto:Wayne_...@Beyond-Software.com
Beyond Software, Inc. http://www.beyond-software.com
"Transforming Legacy Applications"

Jose Moreno

unread,
Jan 29, 1998, 3:00:00 AM1/29/98
to

you can use the SYSDSN function
x = SYSDSN('PREFIX.DATA.SET')
returns "OK" if dataset exists
or "DATASET NOT FOUND" otherwise

Jose Moreno
BMC Software France


John Saxton a écrit dans le message <34D098...@ml.com>...

Binyamin Dissen

unread,
Jan 29, 1998, 3:00:00 AM1/29/98
to

On Fri, 30 Jan 1998 02:00:55 GMT mic...@jeeves.be.cut.this.tail (Michel
Castelein) wrote:

:>John Saxton <John_...@ml.com> wrote:

:>>How can I find out if a file exists under rexx on mvs? I have considered


:>>and tried various iterations of ALLOC and EXECIO. According to the doco
:>>that I read. I thought that ALLOC specified with SHR or OLD would
:>>require that the dataset was already present. Didn't work.

:>>Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
:>>mainframe has confounded me.

:>/* REXX */
:>call MSG OFF /* to suppress TSO informational messages */
:>dsn = "'the-fully-qualified-data-set-name'"
:>address TSO "LISTCAT ENT("dsn")"
:>if RC = 0 say "the dataset" dsn "exist"

I haven't seen the original message, but there is the REXX function SYSDSN:

If I recall correctly it would be used as

If SYSDSN(name) = "OK" Then /* Exists */

--
Binyami...@theoffice.net
Binyamin Dissen <bdi...@netvision.net.il>

Director, Dissen Software, Bar & Grill - Israel

Michel Castelein

unread,
Jan 30, 1998, 3:00:00 AM1/30/98
to

John Saxton <John_...@ml.com> wrote:

>How can I find out if a file exists under rexx on mvs? I have considered
>and tried various iterations of ALLOC and EXECIO. According to the doco
>that I read. I thought that ALLOC specified with SHR or OLD would
>require that the dataset was already present. Didn't work.

>Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
>mainframe has confounded me.

/* REXX */
call MSG OFF /* to suppress TSO informational messages */
dsn = "'the-fully-qualified-data-set-name'"
address TSO "LISTCAT ENT("dsn")"
if RC = 0 say "the dataset" dsn "exist"

Regards,

Michel


Michel Castelein, OS/390 (MVS) System Engineer & Education Consultant
E-mail Mic...@Jeeves.be Home page http://www.club.innet.be/~pub00543/
Company: JEEVES CONSULTING N.V. (phone +32-2-2516650 / fax +32-2-2525755)


Jim Van Sickle

unread,
Jan 30, 1998, 3:00:00 AM1/30/98
to

I'm with Wayne--LISTDSI is the way to go...SYSDSN always RECALLs the dataset if
it's MIGRATed; this is controllable with LISTDSI.
Cheers :-)

Wayne L. Beavers wrote:


>
> John Saxton wrote:
> >
> > How can I find out if a file exists under rexx on mvs? I have considered
> > and tried various iterations of ALLOC and EXECIO. According to the doco
> > that I read. I thought that ALLOC specified with SHR or OLD would
> > require that the dataset was already present. Didn't work.
> >
> > Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> > mainframe has confounded me.
>

> I think you want LISTDSI.
> --
> Wayne L. Beavers mailto:Wayne_...@Beyond-Software.com
> Beyond Software, Inc. http://www.beyond-software.com
> "Transforming Legacy Applications"

--
***********************************************
* Jim Van Sickle <mailto:jim...@ibm.net> *
* Manager, Operations and Tech Support *
* United Retail, Inc. *
*---------------------------------------------*
* visit my meager web site at: *
* <http://mypage.ihost.com/jimswebsite/> *
***********************************************

Bob Seguin

unread,
Jan 30, 1998, 3:00:00 AM1/30/98
to

G'Day, John :)

Here's one way to determine if a dataset exists:

/* Validate DSN from panel */
[snip]
If DatasetExists(ITTGTBN) then
ispexec 'VPUT (ITTGTBN) PROFILE'
Else
Do
Say '==> Dataset "'ITTGTBN'" not found. Please redo config.'
ItCfgOK='N'
End
[snip]
Exit

DatasetExists: PROCEDURE
Arg DSN
FileName=SysDSN("'"DSN"'")
Return (FileName='OK')
/* End od snippet */

Hope this helps you out.

JRS
_________________ Reply Header _________________
Date: Thu, 29 Jan 1998 09:55:46 -0500
From: John Saxton <John_...@ML.COM>
Subject: How to Test is a File Exists under REXX/MVS

Phillip MacLean

unread,
Jan 31, 1998, 3:00:00 AM1/31/98
to

for mainframe (especially if you're after a PDS member, and it isn't there)
ALLOC will not you fail and EXECIO will die with a system error, so, use
the library management functions... do an LMINIT followed by LMOPEN, the
LMOPEN will give you a nice little return code if the member/file is not
there.. also, if the system is 'using' the PDS (i.e. backing up or
whatever), the EXECIO will fail (even though allocated with SHR) however,
the 'LM' routines WILL access the member for you.. this is especially handy
for PDS members.
Phil MacLean

Michel Castelein <mic...@jeeves.be.cut.this.tail> wrote in article
<6aqcv9$bjd$1...@xenon.inbe.net>...


> John Saxton <John_...@ml.com> wrote:
>
> >How can I find out if a file exists under rexx on mvs? I have considered
> >and tried various iterations of ALLOC and EXECIO. According to the doco
> >that I read. I thought that ALLOC specified with SHR or OLD would
> >require that the dataset was already present. Didn't work.
>
> >Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> >mainframe has confounded me.
>

DMcRitchie

unread,
Feb 1, 1998, 3:00:00 AM2/1/98
to

** How to Test if File Exists under REXX/MVS **

It is generally best to check that the dataset exists or is available before
trying to do anything. It could be that it is not available to you due to RACF
protection and it is better to test first , rather than pick up a failure code
when trying to open a file.

REXX syntax:  x = SYSDSN("'sys1.userproc'")

OK /*the data sets exists or the data set and memb
MEMBER NOT FOUND
MEMBER SPECIFIED, BUT THE DATASET IS NOT PARTITIONED
DATASET NOT FOUND
ERROR PROCESSING REQUESTED DATASET
PROTECTED DATASET /* the dataset is RACF-protected*/
VOLUME NOT ON SYSTEM
INVALID DATASET NAME, dsname
MISSING DATA SET NAME
UNAVAILABLE DATASET

CLIST syntax:  x = &SYSDSN('sys1.userproc')

REXX syntax:  x = SYSDSN("'sys1.userproc'")
or x = SYSDSN('''sys1.userproc''')
unqualified as x = SYSDSN('libr.exec')
or x = SYSDSN(libr.exec)
REXXSAA on a PC x = stream('...\file.txt','c','query exists')
return full pathname if file exists, null string i.

David McRitchie
DMcRi...@aol.com

cc: >From: "Phillip MacLean" <mac...@earthlink.net>

Bill Lynch

unread,
Feb 1, 1998, 3:00:00 AM2/1/98
to

Phillip MacLean wrote:
>
> for mainframe (especially if you're after a PDS member, and it isn't there)
> ALLOC will not you fail and EXECIO will die with a system error, so, use
> the library management functions... do an LMINIT followed by LMOPEN, the
> LMOPEN will give you a nice little return code if the member/file is not
> there.. also, if the system is 'using' the PDS (i.e. backing up or
> whatever), the EXECIO will fail (even though allocated with SHR) however,
> the 'LM' routines WILL access the member for you.. this is especially handy
> for PDS members.
> Phil MacLean

Someone else has already mentioned the SYSDSN function, I've used the
following to test if a particular member exists before proceeding:

dsn = LYNCH.TEST.MACLIB /* however you determine this */
member = MAC1 /* however you determine this, too */
dsnck = dsn"("member")"

/* make sure the DSN exists before here */
xxx = SYSDSN("'"dsnck"'")

if xxx = "MEMBER NOT FOUND"
then .... /* member doesn't exist logic */
else ... /* member does exist logic */

The above is strictly to illustrate how to get the "MEMBER NOT FOUND"
response, I generally validate that the DSN exists (as someone else
noted, LISTDSI might be a better choice here than SYSDSN), then see if
the DSN(MEMBER) exists, so the "if" would be:

if xxx = "OK"
then ... /* process the member */
else ... /* member doesn't exist logic */

Two disclaimers: 1. I'm not familiar with the LM... functions (although
I've saved some posts & am starting to get an handle on them) and, 2.
this is not tested code, I hope it's correct but it may have typos - my
apologies for any confusion. I trust the logic is clear.

Hope this is helpful,
Bill Lynch

>
> Michel Castelein <mic...@jeeves.be.cut.this.tail> wrote in article
> <6aqcv9$bjd$1...@xenon.inbe.net>...
> > John Saxton <John_...@ml.com> wrote:
> >
> > >How can I find out if a file exists under rexx on mvs? I have considered
> > >and tried various iterations of ALLOC and EXECIO. According to the doco
> > >that I read. I thought that ALLOC specified with SHR or OLD would
> > >require that the dataset was already present. Didn't work.
> >
> > >Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> > >mainframe has confounded me.
> >
> > /* REXX */
> > call MSG OFF /* to suppress TSO informational messages */
> > dsn = "'the-fully-qualified-data-set-name'"
> > address TSO "LISTCAT ENT("dsn")"
> > if RC = 0 say "the dataset" dsn "exist"
> >
> > Regards,
> >
> > Michel
> >
> >

Bill Turner, WB4ALM

unread,
Feb 1, 1998, 3:00:00 AM2/1/98
to

If you are trying to process -all- members of a PDS, then do this.

1. Check to see if the PDS exists. Since you are going to process
all of the members, use SYSDSN. (Migration is not a concern.)

2. Trap the output of a "LISTA -dsn- MEMBERS" command

3. Plug the member names, one at a time into a standard
"ALLOC DD(xxxx) DA(xxxxxxx) SHR REUSE" command

4. process the member(s).

Don't use the ISPF LM routines, unless you have other ISPF
services that you are also going to use. Save the overhead.

/s/ Bill Turner, wb4alm

John M. Saxton, Jr.

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

This didn't work. IKJ56500I COMMAND LISTDSI NOT FOUND. Could it be installation
dependent?

Jim Van Sickle wrote:

> I'm with Wayne--LISTDSI is the way to go...SYSDSN always RECALLs the dataset if
> it's MIGRATed; this is controllable with LISTDSI.
> Cheers :-)
>
> Wayne L. Beavers wrote:
> >

> > John Saxton wrote:
> > >
> > > How can I find out if a file exists under rexx on mvs? I have considered
> > > and tried various iterations of ALLOC and EXECIO. According to the doco
> > > that I read. I thought that ALLOC specified with SHR or OLD would
> > > require that the dataset was already present. Didn't work.
> > >
> > > Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> > > mainframe has confounded me.
> >

> > I think you want LISTDSI.
> > --
> > Wayne L. Beavers mailto:Wayne_...@Beyond-Software.com
> > Beyond Software, Inc. http://www.beyond-software.com
> > "Transforming Legacy Applications"
>
> --
> ***********************************************
> * Jim Van Sickle <mailto:jim...@ibm.net> *
> * Manager, Operations and Tech Support *
> * United Retail, Inc. *
> *---------------------------------------------*
> * visit my meager web site at: *
> * <http://mypage.ihost.com/jimswebsite/> *
> ***********************************************

--
This bit of nonsense brought to you by the annoying spammers who like to troll the
news groups for new people to annoy. Protect yourself and obfuscate your email
address.

Return address is John underscore Saxton at ML dot com

John M. Saxton, Jr.

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

Thanks for all of your help. I eventually stumbled on the LM functions in
the IBM doco. Cleverly hidden, but I found them. However, I think I will go
with the SYSDSN.

Thanks again.

John Saxton wrote:

> How can I find out if a file exists under rexx on mvs? I have considered
> and tried various iterations of ALLOC and EXECIO. According to the doco
> that I read. I thought that ALLOC specified with SHR or OLD would
> require that the dataset was already present. Didn't work.
>
> Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> mainframe has confounded me.

--

John M. Saxton, Jr.

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

I learned a bit about the LM functions while looking into this problem. This is
the solution I came up with. However I will be replacing it with logic to support
SYSDSN because SYSDSN is one call, and is probably (I don't know this FOR SURE)
less overhead.

(The DDVAR is a variable that is allocated in a shared pool. I guess it is
similar to a file handle on the PC. Once we have a file handle in DDVAR, we can
do the rest of the functions)

found = ' '
notfound = ' '
address ISPEXEC "LMINIT DATAID(DDVAR) DATASET("srclib")" /* my source
library */
address ISPEXEC "LMOPEN DATAID(&DDVAR) OPTION(INPUT)"

do i = 1 to pgms.0 /* stem populated
elsewhere */
parse var pgms.i pgm jcl part .
if part = 'SL' then
do
address ISPEXEC "LMMFIND DATAID(&DDVAR) MEMBER("pgm")"

if rc = 0 then /* build list of found, not found programs
*/
found = found pgm ' '
else
notfound = notfound pgm ' '
end
end

address ISPEXEC "LMCLOSE DATAID(&DDVAR)"


Bill Lynch wrote:

> > > John Saxton <John_...@ml.com> wrote:
> > >
> > > >How can I find out if a file exists under rexx on mvs? I have considered
> > > >and tried various iterations of ALLOC and EXECIO. According to the doco
> > > >that I read. I thought that ALLOC specified with SHR or OLD would
> > > >require that the dataset was already present. Didn't work.
> > >
> > > >Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> > > >mainframe has confounded me.
> > >

> > > /* REXX */
> > > call MSG OFF /* to suppress TSO informational messages */
> > > dsn = "'the-fully-qualified-data-set-name'"
> > > address TSO "LISTCAT ENT("dsn")"
> > > if RC = 0 say "the dataset" dsn "exist"
> > >
> > > Regards,
> > >
> > > Michel
> > >
> > >
> > > Michel Castelein, OS/390 (MVS) System Engineer & Education Consultant
> > > E-mail Mic...@Jeeves.be Home page http://www.club.innet.be/~pub00543/
> > > Company: JEEVES CONSULTING N.V. (phone +32-2-2516650 / fax +32-2-2525755)
> > >
> > >

--

Bill Lynch

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

John M. Saxton, Jr. wrote:
>
> This didn't work. IKJ56500I COMMAND LISTDSI NOT FOUND. Could it be installation
> dependent?
>

Are you set to ADDRESS TSO commands? As in:

ADDRESS TSO
LISTDSI ...

Bill Lynch

(snipped)

Frank Clarke

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

mic...@jeeves.be.cut.this.tail (Michel Castelein) wrote:

>Bill Lynch <WBL...@worldnet.att.net> wrote:

>>ADDRESS TSO
>>LISTDSI ...

He got an IKJ... message. Would they be issued from another
address()?


Frank Clarke
Tampa Area REXX Programmers' Alliance
Member of the REXX Language Association
Join us at http://www.rexxla.org
(Remove the currency symbol before replying.)


Frank Clarke

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

Throw that d*** CLIST manual in the trash.


"John M. Saxton, Jr." <cpu...@sprynet.com> wrote:

> address ISPEXEC "LMOPEN DATAID(&DDVAR) OPTION(INPUT)"

Not quite. "LMOPEN DATAID("ddvar") OPTION(INPUT)"
By this time, ddvar is a populated REXX variable; lose the ampersand.


> address ISPEXEC "LMMFIND DATAID(&DDVAR) MEMBER("pgm")"

Ditto. .....DATAID("ddvar") MEMB......

> found = found pgm ' '
The ' ' is redundant above and below.
> notfound = notfound pgm ' '

> address ISPEXEC "LMCLOSE DATAID(&DDVAR)"
See above...

david_alcock

unread,
Feb 2, 1998, 3:00:00 AM2/2/98
to

In article <34D098...@ml.com>, John says...
>
>How can I find out if a file exists under rexx on mvs? {snip}

>
>Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
>mainframe has confounded me.

I see that you already have some good responses from various people. If you
would like to check out my web page that ATTEMPTS to address I/O among other
things to make writing REXX execs that are portable across different platforms,
go to my "REXX Anywhere!" web page off URL: http://www.ticnet.com/davea

Michel Castelein

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Bill Lynch <WBL...@worldnet.att.net> wrote:

>John M. Saxton, Jr. wrote:
>>
>> This didn't work. IKJ56500I COMMAND LISTDSI NOT FOUND. Could it be installation
>> dependent?
>>

>Are you set to ADDRESS TSO commands? As in:

>ADDRESS TSO
>LISTDSI ...

>Bill Lynch

>(snipped)

LISTDSI is NOT a TSO command; it is a TSO/E external function !!!
(Do not confuse LISTDSI with TSO commands such as LISTCAT and LISTDS.)

/* REXX */
dummy = LISTDSI("data-set-name")

The function's return code is not the most important issue.
Its side-effect is to initialize a bunch of specific variables such as
SYSDSNAME, SYSVOLUME, SYSUNIT, SYSDSORG, etc.

Bob Luce

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

John - I don't know if I understand your question but if you are looking
for a member in a Clist or REXX library you can use TSO command LISTALC
with the REXX command OUTTRAP to capture the datasets allocated to you.
Then you can analyze each dataset using TSO command LISTDS to examine each
member (again with OUTTRAP) to see if it is the REXX or Clist you are
looking for. I'm not quite sure what you mean by a file existing under
rexx though. But if that is what you want, I have such a routine I would
be glad to give to you...Bob Luce (APL in Oakland)

John Saxton <John_...@ml.com> wrote in article <34D098...@ml.com>...


> How can I find out if a file exists under rexx on mvs? I have considered
> and tried various iterations of ALLOC and EXECIO. According to the doco
> that I read. I thought that ALLOC specified with SHR or OLD would
> require that the dataset was already present. Didn't work.
>

Bill Lynch

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Michel Castelein wrote:
>
> Bill Lynch <WBL...@worldnet.att.net> wrote:
>
(snip)

> LISTDSI is NOT a TSO command; it is a TSO/E external function !!!
> (Do not confuse LISTDSI with TSO commands such as LISTCAT and LISTDS.)
>
> /* REXX */
> dummy = LISTDSI("data-set-name")
>
> The function's return code is not the most important issue.
> Its side-effect is to initialize a bunch of specific variables such as
> SYSDSNAME, SYSVOLUME, SYSUNIT, SYSDSORG, etc.
>

Very well, you've forced me to logon to work & to copy some real code. I
coded the following:

+ File+ Edit+ Confirm+ Menu+ Utilities-1+ Utilities-2+ Compilers+ Test+
Help_
------------------------------------------------------------------------------
EDIT ASPAWL1.TSO.CLIST(ASPCOPY) - 01.00 Columns 00001
00072
Command ===> Scroll
===> CSR
000187
/*******************************************************************/
000188 /* check requestor's
USERID */
000189
/*******************************************************************/
000190 profile = aspreqid".ISPF.PROFILE"
000191 reqreq = LISTDSI("'"profile"'")
000192
000193 if reqreq < 8 /* user known to
ISPF? */
000194 then reqmsg = "" /* yes,
okay */
000195 else reqmsg = "Invalid requestor ID("reqreq")"
000196

sometime in 1995 to solve a suddenly emergent problem using SYSDSN to
check if I'd been passed a valid USERID. SYSDSN started failing (after 4
years of working!) if the USERID was logged on. LISTDSI works reliably
even if USERID is logged on. In this case the RC is all I care about,
anything < 8 means the USERID is real (in other REXX pgms I'm after
SYSVOLUME, SYSDSORG, etc.).

Hope this is more helpful,
Bill Lynch

Bill Lynch

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Frank Clarke wrote:

>
> mic...@jeeves.be.cut.this.tail (Michel Castelein) wrote:
>
> >Bill Lynch <WBL...@worldnet.att.net> wrote:
>
> >>John M. Saxton, Jr. wrote:
> >>>
> >>> This didn't work. IKJ56500I COMMAND LISTDSI NOT FOUND. Could it be installation
> >>> dependent?
> >>>
>
> >>Are you set to ADDRESS TSO commands? As in:
>
> >>ADDRESS TSO
> >>LISTDSI ...
>
> He got an IKJ... message. Would they be issued from another
> address()?
>

Frank,

I set TRACE(I) for the example shown below. Prior to this point I issued
an ADDRESS TSO statement. I can't think of anything else that might
apply to your situation.

+ 183 *-* prod_lib = "BASP.PROD.LIB1"+
+ >L> "BASP.PROD.LIB1"+
+ 184 *-* fromleg = "Prod"+
+ >L> "Prod"+
+ 185 *-* end /**/+
+ 186 *-* end /**/+
+ 188 *-* /**/+
+ 189 *-* /**/+
+ 190 *-* /**/+
+ 191 *-* profile = aspreqid".ISPF.PROFILE"+
+ >V> "ASPAWL1"+
+ >L> ".ISPF.PROFILE"+
+ >O> "ASPAWL1.ISPF.PROFILE"+
+ 192 *-* reqreq = LISTDSI("'"profile"'")+
+ >L> "'"+
+ >V> "ASPAWL1.ISPF.PROFILE"+
+ >O> "'ASPAWL1.ISPF.PROFILE"+
+ >L> "'"+
+ >O> "'ASPAWL1.ISPF.PROFILE'"+
+ >F> "0"+
+ 194 *-* if reqreq < 8 /**/+
+ >V> "0"+
+ >L> "8"+
+***+
+
4A X # ^
Proceed

Hope this helps,
Bill Lynch

Phillip MacLean

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

read my lips, the case i am quoting (not theoretical, i ran into it last
week) concerns when SYSDSN says yes i'm here, ALLOC works just find AND
then EXECIO fails (something has the member held in such a way EXECIO will
not work, I don;t know the details, ask IBM). In this case the LM functions
work flawlessly, then you run with EXECIO and it dies
Phil MacLean

Bill Turner, WB4ALM <wb4...@gte.net> wrote in article
<6b3cpr$mtk$2...@gte2.gte.net>...


> If you are trying to process -all- members of a PDS, then do this.
>
> 1. Check to see if the PDS exists. Since you are going to process
> all of the members, use SYSDSN. (Migration is not a concern.)
>
> 2. Trap the output of a "LISTA -dsn- MEMBERS" command
>
> 3. Plug the member names, one at a time into a standard
> "ALLOC DD(xxxx) DA(xxxxxxx) SHR REUSE" command
>
> 4. process the member(s).
>
> Don't use the ISPF LM routines, unless you have other ISPF
> services that you are also going to use. Save the overhead.
>
> /s/ Bill Turner, wb4alm
>
>

> > > > >How can I find out if a file exists under rexx on mvs? I have
considered
> > > > >and tried various iterations of ALLOC and EXECIO. According to the
doco
> > > > >that I read. I thought that ALLOC specified with SHR or OLD would
> > > > >require that the dataset was already present. Didn't work.
> > > >
> > > > >Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but
sofar the
> > > > >mainframe has confounded me.
> > > >

> > > > /* REXX */
> > > > call MSG OFF /* to suppress TSO informational messages */
> > > > dsn = "'the-fully-qualified-data-set-name'"
> > > > address TSO "LISTCAT ENT("dsn")"
> > > > if RC = 0 say "the dataset" dsn "exist"
> > > >

Phillip MacLean

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

i fail to understand how 'it is generally best to check that the dataset
exists or is available', has anything to do with what I was stating. In the
case I cited, SYSDSN will return just fine, ALLOC will work just fine,
EXECIO blows up. Skip all the other checks, LMINIT is neutral and simply
required, LMOPEN will return any of the 'this is not good' info you need if
you can;t get it, and LMMFIND will tell you if you even have a member, if
you do LMGET will get it EVEN in cases where SYSDSN works, ALLOC works and
EXECIO fails.
Phil MacLean

DMcRitchie <dmcri...@aol.com> wrote in article
<19980201033...@ladder02.news.aol.com>...

> >for mainframe (especially if you're after a PDS member, and it isn't
there)
> >ALLOC will not you fail and EXECIO will die with a system error, so, use
> >the library management functions... do an LMINIT followed by LMOPEN,
the
> >LMOPEN will give you a nice little return code if the member/file is not
> >there.. also, if the system is 'using' the PDS (i.e. backing up or
> >whatever), the EXECIO will fail (even though allocated with SHR)
however,
> >the 'LM' routines WILL access the member for you.. this is especially
handy
> >for PDS members.
> >Phil MacLean
> >

John M. Saxton, Jr.

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Yes sir I did. In fact I tried it both from a TSO command prompt and from a REXX
program.

Bill Lynch wrote:

> John M. Saxton, Jr. wrote:
> >
> > This didn't work. IKJ56500I COMMAND LISTDSI NOT FOUND. Could it be installation
> > dependent?
> >
>
> Are you set to ADDRESS TSO commands? As in:
>
> ADDRESS TSO
> LISTDSI ...
>

> Bill Lynch
>
> (snipped)

Wayne L. Beavers

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Phillip MacLean wrote:
>
> read my lips, the case i am quoting (not theoretical, i ran into it last
> week) concerns when SYSDSN says yes i'm here, ALLOC works just find AND
> then EXECIO fails (something has the member held in such a way EXECIO will
> not work, I don;t know the details, ask IBM). In this case the LM functions
> work flawlessly, then you run with EXECIO and it dies
> Phil MacLean
>

It is starting to sound like someone has an ISPF ENQ on a member of the
PDS. Could it be that LM* routines just wait for the ENQ to be released
and EXECIO is failing instead of WATing?

John M. Saxton, Jr.

unread,
Feb 3, 1998, 3:00:00 AM2/3/98
to

Man!!! This has generated a mountain of good hints!!!! My only regret is
that I made a typo in the Subject.

John Saxton wrote:

> How can I find out if a file exists under rexx on mvs? I have considered
> and tried various iterations of ALLOC and EXECIO. According to the doco
> that I read. I thought that ALLOC specified with SHR or OLD would
> require that the dataset was already present. Didn't work.
>
> Any other ideas? This is easy on OS/2, DOS, UNIX, and NT, but sofar the
> mainframe has confounded me.

--

Phillip MacLean

unread,
Feb 4, 1998, 3:00:00 AM2/4/98
to

today, in a different PDS I had same thing happen with a particular member
with this variation ... 1. SYSDSN against the dataset with member specified
said the data set did not exist, 2. LISTDSI returned a failure with a
reason code indicating SVC 99 (dynamic allocation) failed, 3. ALLOC worked
just fined and EXECIO failed, 4. the LM routines (INIT, OPEN, MFIND and
MGET on the member all worked fine, read the file, returned 0 in the return
codes. THIS ALL occurred within 1 EXEC. same result over and over, many
runs. Which brings me to the point of my earlier post, if you are after a
PDS member, use the library management functions, a bad LMOPEN will tell
you the file isn't there and a bad LMMFIND will tell you the member isn't
there. Otherwise, you get the data, WHICH DOES NOT HAPPEN using ALL of the
other suggested methods, so, why bother with them in the first place? If
the problem is an ISPF ENQ killing all the other methods but the LM still
works, that simply re-enforces the argument that this is the only sensible
way to go after PDS members.
Phil MacLean


Wayne L. Beavers <way...@beyond-software.com> wrote
> > <snip>>

Jim Van Sickle

unread,
Feb 6, 1998, 3:00:00 AM2/6/98
to

Phillip,
This sounds quite screwy indeed. Are you doing the SYSDSN and LISTDSI from
within the exec that *created* the PDS member, perhaps using DYNALLOC? I can't
believe this would happen with a (closed) cataloged dataset.

* Could you post a relevant snipped of your code?
* What system codes or messages (if any) are you seeing on the joblog or SYSLOG
as a result of the EXECIO?
* What's EXECIO's return code?
* Are you running foreground or batch?

--

0 new messages