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

ALLOC Technique

13 views
Skip to first unread message

Mosley, George

unread,
Jun 12, 2003, 6:28:04 PM6/12/03
to
Hello List.

I'm wondering if anyone out there has a technique for handling the following
file allocation task in one step:

If the file exists, I want to allocate as OLD, i.e. I want to write over any
existing content. If the file doesn't exist, I want to allocate as NEW.

I currently do it this way:

msgstat = MSG('off')
"DELETE ('"BTS_session"')"
msgrset = MSG(msgstat)

"ALLOC F(BTSOUT) DA('"BTS_Session"') NEW ,
UNIT(SYSDA) TRACKS SP(60,50) ,
BUFNO(15) LRECL(133) ,
RECFM(F B A) DSORG(PS)"

Is there some way I can drop the DELETE?

Thanks,

George

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

Valone, Toren W.

unread,
Jun 12, 2003, 6:36:46 PM6/12/03
to
Try checking for files existence with a Sysdsn, if its there write over
existing data with a SHR if the file does not exist, allocate it and write
to it. Don't think you can do it in one step.

Frank Clarke

unread,
Jun 12, 2003, 7:45:21 PM6/12/03
to
On 12 Jun 2003 15:28:04 -0700, George...@ICBC.COM (Mosley, George)
wrote:
<E478EF9AB22CD3119B44...@ex01mb299.icbc.net>

>I currently do it this way:
>
>msgstat = MSG('off')
>"DELETE ('"BTS_session"')"
>msgrset = MSG(msgstat)
>
>"ALLOC F(BTSOUT) DA('"BTS_Session"') NEW ,
> UNIT(SYSDA) TRACKS SP(60,50) ,
> BUFNO(15) LRECL(133) ,
> RECFM(F B A) DSORG(PS)"
>
>Is there some way I can drop the DELETE?

fb133.0 = "NEW CATALOG UNIT(SYSDA) SPACE(60 50) TRACKS",
"RECFM(F B A) LRECL(133) BLKSIZE(0)"
fb133.1 = "SHR" /* if it already exists... */

tempstat = Sysdsn(outdsn) = "OK" /* 1=exists, 0=missing */
"ALLOC FI(BTSOUT) DA("outdsn") REU" fb133.tempstat

Jeremy C B Nicoll

unread,
Jun 12, 2003, 9:15:24 PM6/12/03
to
In article <kv3ievsomufoijn15...@4ax.com>,
Frank Clarke <ni...@MINDSPRING.COM> wrote:

> tempstat = Sysdsn(outdsn) = "OK" /* 1=exists, 0=missing */

In some cases testing to see if: sysdsn(dsn) equals "OK" is a bad idea,
because sysdsn() can return a bunch of other values admittedly in
strange circumstances. I think for example there's a no-access to
dataset message. It's sometimes safer to test for sysdsn() not being
equal to "DATASET NOT FOUND".

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

Frank Clarke

unread,
Jun 12, 2003, 10:08:27 PM6/12/03
to
On 12 Jun 2003 18:15:24 -0700, Jer...@OMBA.DEMON.CO.UK (Jeremy C B
Nicoll) wrote:
<4c01ab41...@omba.demon.co.uk>

>In article <kv3ievsomufoijn15...@4ax.com>,
> Frank Clarke <ni...@MINDSPRING.COM> wrote:
>
>> tempstat = Sysdsn(outdsn) = "OK" /* 1=exists, 0=missing */
>
>In some cases testing to see if: sysdsn(dsn) equals "OK" is a bad idea,
>because sysdsn() can return a bunch of other values admittedly in
>strange circumstances. I think for example there's a no-access to
>dataset message. It's sometimes safer to test for sysdsn() not being
>equal to "DATASET NOT FOUND".

Won't there be unpleasant results regardless? If the response is "NO
ACCESS", I'll try to allocate it NEW, you'll try to allocate it SHR.
Neither will succeed.

Which reminds me... Don, Chris, JD... the bet's off.

Jeremy C B Nicoll

unread,
Jun 13, 2003, 8:48:31 AM6/13/03
to
In article <3ccievk8626li97uo...@4ax.com>,

Frank Clarke <ni...@MINDSPRING.COM> wrote:
> On 12 Jun 2003 18:15:24 -0700, Jer...@OMBA.DEMON.CO.UK (Jeremy C B
> Nicoll) wrote:
> <4c01ab41...@omba.demon.co.uk>

> >In article <kv3ievsomufoijn15...@4ax.com>,
> > Frank Clarke <ni...@MINDSPRING.COM> wrote:
> >
> >> tempstat = Sysdsn(outdsn) = "OK" /* 1=exists, 0=missing */
> >
> >In some cases testing to see if: sysdsn(dsn) equals "OK" is a bad
> >idea, because sysdsn() can return a bunch of other values admittedly
> >in strange circumstances. I think for example there's a no-access
> >to dataset message. It's sometimes safer to test for sysdsn() not
> >being equal to "DATASET NOT FOUND".

> Won't there be unpleasant results regardless? If the response is "NO
> ACCESS", I'll try to allocate it NEW, you'll try to allocate it SHR.
> Neither will succeed.

Yes in this case, but code that checks whether a dataset (or member of
a dataset) exists doesn't always then do something that will run under
that userid - it might a generate a batch job, or set someting up to be
run by some other id. And, getting an access-denied message when you
expect just "OK" or "MEMBER NOT FOUND" and only testing for one
possible message is potentially dangerous. I only know this because
I've had code fail as a consequence. Most people use sysdsn() as if it
will *always* tell them that the dataset does or does not exist, or
that a member does or does not exist in a pds, and unfortunately the
routine can essentially return "maybe" answers too - that's all I'm
saying.

Diehl, Gary

unread,
Jun 13, 2003, 9:11:48 AM6/13/03
to
I wonder, wouldn't it be simplest to just allocate it using MOD, free it,
and the reallocate it using SHR?

That way, if it doesn't exist, MOD will create it. If it does exist, MOD
will have no effect. And on the second allocation SHR will put the file
pointer to the beginning of file for output.

Best Regards,

Gary

-----Original Message-----
From: Mosley, George [mailto:George...@ICBC.COM]
Sent: Thursday, June 12, 2003 5:27 PM
To: TSO-...@VM.MARIST.EDU
Subject: ALLOC Technique

Hello List.

I'm wondering if anyone out there has a technique for handling the following

file allocation task in one step:

If the file exists, I want to allocate as OLD, i.e. I want to write over any

existing content. If the file doesn't exist, I want to allocate as NEW.

I currently do it this way:

msgstat = MSG('off')
"DELETE ('"BTS_session"')"
msgrset = MSG(msgstat)

"ALLOC F(BTSOUT) DA('"BTS_Session"') NEW ,
UNIT(SYSDA) TRACKS SP(60,50) ,
BUFNO(15) LRECL(133) ,
RECFM(F B A) DSORG(PS)"

Is there some way I can drop the DELETE?

Thanks,

George

Mosley, George

unread,
Jun 13, 2003, 11:36:35 AM6/13/03
to
Thanks, all. Some good discussion (as always). Have to say I like the
elegance of Frank's solution. Plus, in my instance, there's no risk if the
rare exception does occur.

George

Ryerse, Robin

unread,
Jun 13, 2003, 12:42:59 PM6/13/03
to
I have a function quite like SYSDSN but is independent of TSO. The function
returns a logical value (1 or 0) indicating the existence of the the named
dataset. The assembler routine does a (catalog) LOCATE and OBTAIN (if disk
dataset). Apart from its primary function, the routine will optionally
populate variable names with the value of the VOLSER and the absolute value
of a relative GDG.

I have found the function quite useful in production jobstreams with
conditional JCL.

The assembler code is ~ 300 lines long. If anyone is interested I can
probably post it in file520 at CBT.

Fogg, George C

unread,
Jun 13, 2003, 2:09:49 PM6/13/03
to
I also have a function that will do a OBTAIN and LOCATE plus if the
dataset is catalog, the function will return your access level (none,
read, update, control, alter) to the dataset for RACF and ACF2 systems.
I haven't tested for a Top Secret security system but I think it will
work. If the dataset is not cataloged or not on the volume that can be
optionally defined then you will receive error messages instead of
return codes. Let me know and I will send you a copy.

George Fogg


> -----Original Message-----
> From: Ryerse, Robin [mailto:robin....@EDS.COM]
> Sent: Friday, June 13, 2003 9:42 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: ALLOC Technique
>

Dave Salt

unread,
Jun 13, 2003, 2:24:54 PM6/13/03
to
Hi George,

If what you have can stop me getting ACF2 violations then I'd be very
interested in getting a copy!Thanks in advance,

Dave Salt
http://www.soft-center.com

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

George, William , DHS-ITSD

unread,
Jun 13, 2003, 2:26:46 PM6/13/03
to
George

Is this the RACFACL program?
If not, how does it differ?

Bill

Fogg, George C

unread,
Jun 13, 2003, 2:32:04 PM6/13/03
to
The same.

Dave Salt

unread,
Jun 13, 2003, 2:35:09 PM6/13/03
to
I don't have the "RACFACL" program so I'd still be grateful if you could
send me a copy. Thanks George,

Dave Salt
http://www.soft-center.com

_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE*
http://join.msn.com/?page=features/virus

Fogg, George C

unread,
Jun 13, 2003, 3:39:36 PM6/13/03
to
You shouldn't see violation messages because the function is basically a
query on what access level you have, not for example, like trying to
open a dataset for update and you only have read or none. I'll send a
copy to those that have requested a copy next Tuesday because I'm out of
the office today and Monday.

John Kalinich

unread,
Jun 16, 2003, 8:23:15 AM6/16/03
to
Dave,

As I discovered, you need to add a SAFDEF in order to successfully use George's rexx function in an ACF2 environment. See doc below.

Regards,
John Kalinich
CSC, St. Louis, MO


To maintain system integrity, CA-ACF2 requires that a user be
authorized to access security definitions; however, some products that
use STATUS=ACCESS are not authorized when they issue the request. The
result is that CA-ACF2 abends the task with a S047 from ACF9C000.
To accommodate these products, CA-ACF2 lets the security administrator
define the specific calls for which the authorization check for
STATUS=ACCESS will be bypassed. This is done with the NOAPFCHK
keyword on a SAFDEF record that describes the specific environment
from which this call is made. For example:

INSERT SAFDEF.apf PROGRAM(pgmname) RB(pgmname) NOAPFCHK
RACROUTE(REQUEST=AUTH,CLASS=DATASET,STATUS=ACCESS)

Dave Salt

unread,
Jun 16, 2003, 8:57:34 AM6/16/03
to
In that case, it's no good to me. I'm not in a position to add a SAFDEF and
in any case was looking for a genric, run it anywhere utility. George,
please disregard my earlier request. Thanks John,

Dave Salt
http://www.soft-center.com

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

Craddock, Chris

unread,
Jun 16, 2003, 9:44:22 AM6/16/03
to
Fuzzy memory, but I don't think you can avoid the ACF913
message when you ask the question unless you are APF auth
and specify the <mumble> keyword. The theory behind issuing
the message is that somebody could just troll for access
until they found something that was "accessible" and go
at it. The messages alert the installation that you're
potentially up to no good.

There's a way you can define a rule that obviates this
requirement for a specific program call but that's maybe
more difficult than you were hoping (and I can't remember
what it is anyway <g>) ACF2 isn't something I dabble in...

Chris

> -----Original Message-----
> From: Fogg, George
> You shouldn't see violation messages because the function is
> basically a
> query on what access level you have, not for example, like trying to
> open a dataset for update and you only have read or none.

Fogg, George C

unread,
Jun 16, 2003, 12:46:22 PM6/16/03
to
You are correct and this ACF2 step needed to be done is documented in
the function. It's allowed in the RACF world to issue the SAF AUTH
request with the STATUS=ACCESS keyword without any special authority,
however, ACF2 requires you to go the extra mile and define the SAFDEF
statement in order for the problem state user to use STATUS=ACCESS. As
Cris mentioned below, perhaps ACF2 developers with pressure from
auditors required this to stop a user to "troll" for access to resources
or some other reasons unknown to me.

George Fogg


> -----Original Message-----
> From: Craddock, Chris [mailto:Chris_C...@BMC.COM]
> Sent: Monday, June 16, 2003 6:43 AM
> To: TSO-...@VM.MARIST.EDU
> Subject: Re: ALLOC Technique
>

0 new messages