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

Is Object In Use?

887 views
Skip to first unread message

ix...@ns.gamewood.net

unread,
Jun 21, 1997, 3:00:00 AM6/21/97
to

How can I determine if a program is alredy active before attempting to
call the same program again. For example, a program is building a file
and another user tries to run the same program - it abends. Is there CL
to solve this problem.

Thanks in advance. ix...@ns.gamewood.net ixie

-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet

The Styer Family

unread,
Jun 21, 1997, 3:00:00 AM6/21/97
to

You can use the OBJLCK commands to identify when an object is being used.
The program itself will not be locked, but any display file or
physical/logical file used by the program will be locked.
ix...@ns.gamewood.net wrote in article <8669162...@dejanews.com>...

Replace nospam with prairie.lakes to reply

unread,
Jun 22, 1997, 3:00:00 AM6/22/97
to

Hello.

One thing you can do is allocate a message queue. Then check to see
if that is allocated before you run it, and if it is, then don't let
someone else use it. The only problem with this is it is a hassle to
deallocate the message queue if the running program bombs.

So, what we have done at our shop, is create a job lock file and
maintance program. When we call a program that can only be run one at
a time (because of temp file building, etc) we call a job lock program
with the program name. If it isn't locked, it becomes locked. If it
IS locked, an error message is sent back saying to try again later.

If a program bombs in this case, it is very easy to just go into the
file and unlock it, or even better, create a program that shows the
status of all jobs that are "lockable". If it is locked, simply
unlock it from the maintanece program.

Brad Stone

On Sat, 21 Jun 1997 13:14:37 -0600, ix...@ns.gamewood.net wrote:

>How can I determine if a program is alredy active before attempting to

Njal Fisketjon (Njål Fisketjøn)

unread,
Jun 22, 1997, 3:00:00 AM6/22/97
to

ix...@ns.gamewood.net wrote:

>How can I determine if a program is alredy active before attempting to
>call the same program again. For example, a program is building a file
>and another user tries to run the same program - it abends. Is there CL
>to solve this problem.
>

Add a few extra commands to your CL-program

ALCOBJ &lib/&file *file *EXCL
MONMSG CPFxxxx (Look up the correct Msgid in the manual or just test it out
interactively)

build code


DLCOBJ &lib/&file *file *EXCL
Njål Fisketjøn
FIGU DATA AS
njal.fi...@figu.no
nfis...@hesgrp.com

Herb Bujak

unread,
Jun 23, 1997, 3:00:00 AM6/23/97
to

I have a command on my web page ...

http://www.geocities.com/SiliconValley/Pines/9037/

that allows you to determine if a specific job is running. Take the
"AS/400 Utilities" link and download ZRTVJOBSTS.


ix...@ns.gamewood.net wrote:

>How can I determine if a program is alredy active before attempting to
>call the same program again. For example, a program is building a file
>and another user tries to run the same program - it abends. Is there CL
>to solve this problem.

>Thanks in advance. ix...@ns.gamewood.net ixie

>-------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post to Usenet

----------------------------------------------
Herb Bujak
Mobile Data Solutions, Inc.
Work: hbu...@mdsi.bc.ca
Home: herb_...@geocities.com
http://www.geocities.com/SiliconValley/Pines/9037/


Steven S. Wood

unread,
Jun 24, 1997, 3:00:00 AM6/24/97
to

ix...@ns.gamewood.net wrote:
>
> How can I determine if a program is alredy active before attempting to
> call the same program again. For example, a program is building a file
> and another user tries to run the same program - it abends. Is there CL
> to solve this problem.
>
> Thanks in advance. ix...@ns.gamewood.net ixie
>
> -------------------==== Posted via Deja News ====-----------------------
> http://www.dejanews.com/ Search, Read, Post
Usenet
There are two ways to solve your problem. Both require a CL program to
call the program that is causing the problem.
1. In the new cl program use:
Realloc: ALCOBJ Obj(library/program *pgm *excl)) Wait(2)
Monmsg Msgid(CPF1002) Exec(do)
/*recovery action */
GOTO Realloc /* to attempt to reallocate */
Enddo
call program
DLCOBJ Obj(library/program *pgm *excl))
This will lock the program to a single user. Message
CPF1002 will be issued when a subsequent user attempts
to lock the program. You need to provide a recovery and
operator information procedure inside the monitor message
do group. The goto branches back to try to allocate the
program again.

2. If the file is always created on start and deleted on end
of the procedure. Use CHKOBJ to existence check the file
before attempting to create it, or monitor for CPF message
CPF7302 after attempting to create the file.

If the application structure is such that the file can only be used by
one person at a time, You need to allocate the file as
*excl or *exclrd to prevent use. Also monitor for CPF1002 and
provide a recovery procedure and inform the workstation operator what is
happening.

Leobardo López

unread,
Jun 28, 1997, 3:00:00 AM6/28/97
to

A good solution is to use a data area that is allocated by the job you
want to run in only one invocation. Data areas don't give much trouble
but is a good practice to allocate *EXCLRD instead of *EXCL, just in
case the job is running by the time your nightly backup kicks off and is
speficied to save while active. You have to deallocate the data area at
the end of your program, though. This approach doesn't cause any trouble
with locked objects in case your job ends abnormally.

Enjoy,

Leo


ix...@ns.gamewood.net wrote:
>
> How can I determine if a program is alredy active before attempting to
> call the same program again. For example, a program is building a file
> and another user tries to run the same program - it abends. Is there CL
> to solve this problem.
>
> Thanks in advance. ix...@ns.gamewood.net ixie
>
> -------------------==== Posted via Deja News ====-----------------------

> http://www.dejanews.com/ Search, Read, Post to Usenet

W.S. Jongman

unread,
Jul 3, 1997, 3:00:00 AM7/3/97
to

Check a data area if it contains a job signature (name/user/number) if it
does, check if the job is still active (rtvjoba or something like that) if
it is, leave it alone. If it is not active, or the data area does not
contain a job signature, write your own in it and do your thang.

Best regards,

WS Jongman

--
[my modest signature]

0 new messages