× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



RE: Best way to check if a program is running
The program I'm trying to find running is a file maintenance program.
One thing I need to check is if a data area in that program is already
allocated to another job. I also need to check if the file being
maintained is locked by another job. Basically I want to see if anyone
else is currently using the program and a second user tries to enter the
program. 
For the time being I am using MONITOR to handle any I/O to the data
area. That captures any errors in the event that the OUT opcode executes
but the data area is already allocated to another job. I'm not quite
sure how to handle the file though. I'm trying to find a command or API
that will show me if a file has any overrides or locks against it. Are
there any commands like DSPOVR or WRKOBJLCK that aren't interactive?   

-----Original Message-----
From: rpg400-l-request@xxxxxxxxxxxx
[mailto:rpg400-l-request@xxxxxxxxxxxx] 
Sent: Thursday, October 23, 2003 7:08 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RPG400-L Digest, Vol 2, Issue 797

Send RPG400-L mailing list submissions to
        rpg400-l@xxxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
        rpg400-l-request@xxxxxxxxxxxx

You can reach the person managing the list at
        rpg400-l-owner@xxxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."


Today's Topics:

   1. RE: Benefits of Sub-procedures (John Taylor)
   2. Re: Benefits of Sub-procedures (Brad Stone)
   3. Re: Best way to check if a certain program is running
      (Vasant Patel)
   4. Re: Best way to check if a certain program is running
      (Douglas Handy)
   5. Re: Best way to check if a certain program is running
      (Vasant Patel)
   6. Re: Benefits of Sub-procedures (Alan E.)
   7. Re: Benefits of Sub-procedures (Ken Sims)
   8. RE: Message subfile in sub-procedure (Reeve)
   9. Re: Benefits of Sub-procedures (Joel Cochran)
  10. Re: Benefits of Sub-procedures (MWalter@xxxxxxxxxxxxxxx)


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

message: 1
date: Wed, 22 Oct 2003 16:51:44 -0600
from: "John Taylor" <lists@xxxxxxxxxxxxxxxxxxxx>
subject: RE: Benefits of Sub-procedures


Buck:

> Do they write sub-programs to do one thing, and one thing 
> well? Do their applications written this way provide 
> acceptable performance and maintainability? Do they write 
> sub-procedures to do one thing and one thing well? Do their 
> applications written this way provide acceptable performance 
> and maintainability?
> 
> If the answers to all of the above are yes, then the question 
> makes perfect sense.  They're already writing very modular, 
> re-usable code that is easy to maintain and runs acceptably.  
> What benefits do they accrue from sub-procedures? (they have 
> already brushed aside use in an expressions.)

Let's not forget that the "sub-programs" which perform acceptably today
for occasional interactive use are often the buggers that chew up our
day-end window when called repeatedly in large batch runs!

My point is that a good programmer should be looking forward a little
ways at anticipated uses, and not just at the immediate problem at hand.

Of course, I know I'm preaching to the choir in your case. My comments
are not directed at you, but at the group in general.

Regards,

John Taylor




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

message: 2
date: Wed, 22 Oct 2003 19:06:43 -0500
from: "Brad Stone" <brad@xxxxxxxxxxxx>
subject: Re: Benefits of Sub-procedures

What would be more objects,

a service program that performs your most used Order Entry
Functionality

or

A program for each piece of Order Entry functionality?

or, let's assume they make a callable program to do all
these functions.  Can you imagine what the plist would look
like?  *shudder*

Along with what others have said, modularity and logical
grouping of often used functions will actually shrink the
number of "objects" used rather than increase them. It will
make the programmer more productive in the long run,
allowing you to make more people happy, etc.. etc..

I can tell you, I've written quite a few applicatons
ranging from very large to small.  In every case there is
no way I'd want to go back to program calls vs. using
subprocedures...

Like someone said, it sounds like they already made up
their minds, but maybe the problem is the learning curve.
 Offer then instead of using ILE to just switch entirely
over to Java and see what the reaction is.  :)

Brad
www.bvstools.com


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

message: 3
date: Wed, 22 Oct 2003 20:57:31 -0400
from: Vasant Patel <vasant.patel@xxxxxxxxxxxx>
subject: Re: Best way to check if a certain program is running

Try allocate the program object....ALCOBJ command.....(*EXCL)
exclusive...

If able to allocate the object then, therefore it's not used
currently....

If unable to allocate the object then, therefore it's in use on the 
system somewhere....

Make sure to deallocate the object when allocate is succesful.....

Try it...

Cheers!

Vasant

Bob cozzi wrote:

>One way to do that is to send a program message to the program and then
do a
>receive message (using the message key) to see if the message was
received
>by the program you were looking for.
>
>
>Bob Cozzi
>Cozzi Consulting
>www.rpgiv.com
>
>
>-----Original Message-----
>From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
>On Behalf Of Tom Liotta
>Sent: Wednesday, October 22, 2003 2:51 PM
>To: rpg400-l@xxxxxxxxxxxx
>Subject: RE: Best way to check if a certain program is running
>
>rpg400-l-request@xxxxxxxxxxxx wrote:
>
>  
>
>>  2. Re: Best way to check if a certain program is running
>>     (David Gibbs)
>>
>>Malchow, Grizzly wrote:
>>    
>>
>>>I'm trying to find a command or API that I can use that will let me
know
>>>if a program is currently running. Does anyone know of one that I
could
>>>use in a program that would do that? The command or API will need to
>>>take place behind the scenes, so I'm not looking for an interactive
>>>command. 
>>>      
>>>
>>In the current job or another job?
>>    
>>
>
>Actually executing instructions or just anywhere in a call stack? Only
in
>active activation groups or merely in an activation group that hasn't
been
>reclaimed yet?
>
>I.e., what exactly is meant by "running"? Or maybe better, what need is
>being addressed? There may be alternatives that can be used.
>
>Tom Liotta
>
>  
>





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

message: 4
date: Wed, 22 Oct 2003 21:09:46 -0400
from: Douglas Handy <dhandy1@xxxxxxxxxxxxx>
subject: Re: Best way to check if a certain program is running

Vasant,

>Try allocate the program object....ALCOBJ command.....(*EXCL)
exclusive...
>
>If able to allocate the object then, therefore it's not used
currently....

Actually, that is not true.  *PGM objects are not allocated by the
system while
they are in use, with the exception of triggers.  

However, if the program has a display file (or other unique file), you
could try
allocating it *EXCL.  Alternatively, some people still use the *PGM
object, and
if it fails *EXCL treat it as in use and if they get the lock hold it
until the
program is done and then programatically release it.

Other people create a data area named after the program, and allocate
it.

Doug


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

message: 5
date: Wed, 22 Oct 2003 22:36:14 -0400
from: Vasant Patel <vasant.patel@xxxxxxxxxxxx>
subject: Re: Best way to check if a certain program is running

Doug!

You are correct, I stand corrected....

Thanks!

Vasant

Douglas Handy wrote:

>Vasant,
>
>  
>
>>Try allocate the program object....ALCOBJ command.....(*EXCL)
exclusive...
>>
>>If able to allocate the object then, therefore it's not used
currently....
>>    
>>
>
>Actually, that is not true.  *PGM objects are not allocated by the
system while
>they are in use, with the exception of triggers.  
>
>However, if the program has a display file (or other unique file), you
could try
>allocating it *EXCL.  Alternatively, some people still use the *PGM
object, and
>if it fails *EXCL treat it as in use and if they get the lock hold it
until the
>program is done and then programatically release it.
>
>Other people create a data area named after the program, and allocate
it.
>
>Doug
>_______________________________________________
>This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
>To post a message email: RPG400-L@xxxxxxxxxxxx
>To subscribe, unsubscribe, or change list options,
>visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
>or email: RPG400-L-request@xxxxxxxxxxxx
>Before posting, please take a moment to review the archives
>at http://archive.midrange.com/rpg400-l.
>
>
>  
>





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

message: 6
date: Wed, 22 Oct 2003 22:53:19 -0400
from: "Alan E." <steelville@xxxxxxxxxxx>
subject: Re: Benefits of Sub-procedures

I've still got a couple of those on my machine. <yech!> And
yes, it's an order entry program. It is a "thorn in my
side", but oh so un-tangle-able.

It's a big thing to me to be able to "hide" your variables
inside a procedure. Function-like procedure calls returning
values into expressions for me is *big*, because it can make
those expressions so so much more intuitive.

Also: If procedures can give you everything a subroutine
can, just get them started using the procedure inside the
one program. I hope they aren't creating entire programs
still just to handle normal date routines, for example. They
may be using a subroutine. If they just get started using
them, then some of them will very soon think of something
they can just do better that way.

Man, I haven't formalized out what it is. It's so so
intuitively obvious to me it's hard to understand how
programmers haven't absolutely jumped into it. Sure, I was
cautious at first, you have to be with new things, but if
I'd have had others around to tell me, yeah, go ahead, the
water's not very deep out to there, man..

- Alan


----- Original Message -----
From: "Brad Stone" <brad@xxxxxxxxxxxx>

| or, let's assume they make a callable program to do all
| these functions.  Can you imagine what the plist would
look
| like?  *shudder*
|




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

message: 7
date: Wed, 22 Oct 2003 20:58:46 -0700
from: Ken Sims <mr3111@xxxxxxxxx>
subject: Re: Benefits of Sub-procedures

Hi Bob -

>I personally have been using RPGIV and sub-procedures, service
programs,
>etc. since '96.  But I am running into an ever increasing number of
>programmers that ask the basic question "Why use a sub-procedure when
it
>does the same thing as a program call?"
  <snip>
>p.s. And I have tried arguing easier maintenance - which they will
>always argue that pure ILE RPGIV is harder to maintain because of the
>increased number of objects and source members to keep track of!

Huh????  If they are writing API-type programs to encapsulate functions,

service programs will REDUCE the number of objects.  One service program

can perform the functions of many separate API-type programs.

Another major benefit of procedures (even non-exported procedures within

the same program that calls them) is the use of const and the resulting 
ability to pass expressions as input parameters to the procedure.

And along with that, as you mentioned, the capability to receive a value

back into an expression.

Then combine that to have an expression involving the output of multiple

procedures as an input parameter to yet another procedure.  (Whose
output 
could be the input to yet another procedure in the same overall
expression.)

And how about the ability for a procedure to call itself recursively?
That 
can be nice for chasing chains as long as it doesn't go too deep.

Ken
http://www.ke9nr.net/
Opinions expressed are my own and do not necessarily represent the views
of 
my employer or anyone in their right mind.



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

message: 8
date: Thu, 23 Oct 2003 00:18:28 -0400
from: "Reeve" <news@xxxxxxxxxx>
subject: RE: Message subfile in sub-procedure

Rick, if you're still stuck on this, contact me off-line. 

-Reeve

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
> On Behalf Of Chevalier, Rick
> Sent: Tuesday, October 21, 2003 10:05 AM
> To: RPG400 Mailing List (E-mail)
> Subject: Message subfile in sub-procedure
> 
> I am trying to use a message subfile in a sub-procedure that controls
screen
> handling.  The messages aren't being displayed.  My searches for
examples
only
> uncover sub-routine examples.  Using a sub-procedure changes the call
stack so it's
> not the same.  I'm currently working on variations of the SFLPGMQ key
word.  If
> something doesn't work soon I'm going to have to give up and rewrite
it
using sub-
> routines.
> 
> Has anyone done this?  Is so would you be willing to share some
example
code or
> explain how you got the message sub-file and program message queue in
sync?
> 
> Rick
> 
> _______________________________________________
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.





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

message: 9
date: Thu, 23 Oct 2003 06:45:39 +0000
from: Joel Cochran <jrc@xxxxxxxxxx>
subject: Re: Benefits of Sub-procedures

And to add to the fine points already listed, using procedures verifies
your program calls at compile time rather than run time.  An easy way to
prevent parameter mismatches.  Putting those procedures into service
programs creates fewer objects as Brad mentioned, and also adds "Level
Checking" capabilities to your program (and if done with Binder Source
can be backwards compatible), another way to make sure all the pieces
are in synch.

If none of this convinces them, then I wish you the best of luck... in
your search for new employment... ;)

Joel
http://www.rpgnext.com



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

message: 10
date: Thu, 23 Oct 2003 08:07:15 -0400
from: MWalter@xxxxxxxxxxxxxxx
subject: Re: Benefits of Sub-procedures


Some will never be convinced. I worked for a guy that didn't want me to
us
subroutines. I'm sure his code is still top down RPG III.

Maybe you need to ask the question back, why use subfiles when SRLN
works
just as well? Why use OPNQRYF when sorts work just as well? Why use
structured programming techniques when GOTOs work just as well?

Thanks,

Mark

Mark D. Walter
Senior Programmer/Analyst
CCX, Inc.
mwalter@xxxxxxxxxx
http://www.ccxinc.com


|---------+----------------------------->
|         |           "Bob Cagle"       |
|         |           <bcagle@xxxxxxxxxx|
|         |           m>                |
|         |           Sent by:          |
|         |           rpg400-l-bounces@m|
|         |           idrange.com       |
|         |                             |
|         |                             |
|         |           10/22/2003 05:05  |
|         |           PM                |
|         |           Please respond to |
|         |           RPG programming on|
|         |           the AS400 /       |
|         |           iSeries           |
|         |                             |
|---------+----------------------------->
 
>-----------------------------------------------------------------------
-------------------------------------------------------|
  |
|
  |       To:       <RPG400-l@xxxxxxxxxxxx>
|
  |       cc:
|
  |       Subject:  Benefits of Sub-procedures
|
 
>-----------------------------------------------------------------------
-------------------------------------------------------|




I'm looking for some ammo, guys!

I personally have been using RPGIV and sub-procedures, service programs,
etc. since '96.  But I am running into an ever increasing number of
programmers that ask the basic question "Why use a sub-procedure when it
does the same thing as a program call?"

I always spout the performance benefits, plus the ability to call a
procedure from within an expression and return a value.  But even then
it sometimes isn't enough to convince them.

Can anyone give me some more compelling reasons for switching completely
to ILE RPGIV?  Remember, these are typical business programmers and
statements like "it's cool/fun/looks & works like java/etc." is just
even more of a turnoff for them.  I'm looking to give some sound
business reasons for the change.


p.s. And I have tried arguing easier maintenance - which they will
always argue that pure ILE RPGIV is harder to maintain because of the
increased number of objects and source members to keep track of!

Bob Cagle
IT Manager
Lynk, Inc.
913-492-9202 x41



_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.








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

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) digest
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



End of RPG400-L Digest, Vol 2, Issue 797
****************************************


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.