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"
Jose Moreno
BMC Software France
John Saxton a écrit dans le message <34D098...@ml.com>...
:>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
>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)
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/> *
***********************************************
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
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 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>
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
> >
> >
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
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
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.
--
(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)
> > >
> > >
--
Are you set to ADDRESS TSO commands? As in:
ADDRESS TSO
LISTDSI ...
Bill Lynch
(snipped)
>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.)
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...
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
>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.
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.
>
+ 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
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
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"
> > > >
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
> >
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)
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 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.
--
Wayne L. Beavers <way...@beyond-software.com> wrote
> > <snip>>
* 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?
--