× 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.


  • Subject: Re: AS/400 equivalent to S/36 // IF AC
  • From: "Rick Baird" <rbbaird@xxxxxxxxxxx>
  • Date: Wed, 10 Jun 1998 16:02:54 -0500
  • Organization: Premium Systems, Inc.

Bill,

bmegenity@ruskin.com wrote:
> 
> Rob,
>  Would you elaborate on some of the alternatives. Perhaps even to the
> extent of some sample code. So far the prospects are bleak, to say the
> least. 
Bill,

Here's some suedo code that might help,

Lets say you go the "data area" route.  Also, assume the job you are
checking ISN'T the job that is currently running.

First, create a data area named for the job you want to check - put it
in a library that will normally reside in your library list.

        CRTDTAARA DTAARA(job_name) TYPE(*CHAR) LEN(1).

If the job you want to check for is RPG, use a CLP wrapper to call
it.  

In the CLP of the job you want to check for, place the following lines
at the begining and the end of the pgm.

        PGM
        ALCOBJ OBJ((job_name *DTAARA *SHRRD))
        MONMSG MSGID(CPF1002) EXEC(DO)
you shouldn't allow this job to run... exit program.    
        ENDDO

... the rest of the program...

        DLCOBJ OBJ((job_name *DTAARA *SHRRD))
        ENDPGM

*SHRRD allocates for read only. this allows more than one job to call
the program (and thus allocate the object.)
If it is allocated exclusively anywhere else, it won't be able to
allocate the job and it spits out the following message id:

 "CPF1002 Cannot allocate object &1."

the monitor message picks this up and executes the lines between the
DO and ENDDO.   

Next, to replace the // IF ACTIVE statements, use these lines of code:

        ALCOBJ OBJ((job_name *DTAARA *EXCL))

        MONMSG MSGID(CPF1002) EXEC(DO)
... lines of code to execute if "job_name" is active (presumably you
would issue an error message and exit the program?)     
        ENDDO

This tries to allocate the data area "exclusively".  if it is
allocated anywhere else, it spits CPF1002.  
The monitor message picks this up and executes the lines between the
first DO and ENDDO.   

You must then de-allocate the object, if it was successfully
allocated.  
If you want the checked job to STAY inactive for the duration of this
job, place this line at the end of this program.  If it doesn't
matter, you should put it after the above MONMSG /DO/ENDDO commands,
enclosed in an ELSE(DO) and an (ENDDO)

        DLCOBJ OBJ((job_name *DTAARA *EXCL))

The object is allocated exclusively for the length of the job, and
thus prevents the checked job from being called.

Hope this helps,

Rick
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.