× 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: Whats the best way to run a CL every 30 min
  • From: "Brad Felber" <poprpg@xxxxxxxxxxxx>
  • Date: Wed, 29 Sep 1999 10:39:49 -0500


> Hi!
> Whats the best way in tems of efficiency and CPU perfomance to run a CL
PGM
> every 30 min (for instance) or other interval.
> If you can give code examples it would be great.
>
> TIA
> Silvio.
>

I'm not sure about speed and efficency, but my preferred way is to have the
job submit itself witha sceduled time of 30 minutes from now.   That way
it's not sitting in active status waiting to go.  I actually have a job that
checks out TCP/IP connection to make sure we're still connected to out ISP
(and will start the connection if we're down).  It does a ping every 5
minutes, then resubmits itself (until 5pm)  It is started by a JOBSCDE at
5am.

/* GET THE CURRENT HOUR   */
NEXT:        RTVSYSVAL  SYSVAL(QHOUR) RTNVAR(&CURQHOUR)
             RTVSYSVAL  SYSVAL(QMINUTE) RTNVAR(&CURQMINUTE)
             CHGVAR     VAR(&HOURADD) VALUE(0)

/* IF IT'S 5PM, DON'T SUBMIT IT AGAIN */
             IF         COND(&CURQHOUR *GE '17') THEN(GOTO +
                          CMDLBL(ENDLOOP))

/* CONVERT MINUTES TO A NUMBER AND ADD FIVE TO IT */
             CHGVAR     VAR(&NUMQMINUTE) VALUE(&CURQMINUTE)


/* IF MINUTES IS GREATER THAN 60, SUBTRACT 60, AND ADD ONE TO HOUR */
             IF         COND(&NUMQMINUTE *GT 59) THEN(DO)
                CHGVAR     VAR(&NUMQMINUTE) VALUE(&NUMQMINUTE - 60)
                CHGVAR     VAR(&HOURADD) VALUE(1)
             ENDDO

             CHGVAR     VAR(&NXTQMINUTE) VALUE(&NUMQMINUTE)


/* CONVERT HOUR TO A NUMBER AND ADD HOURADD TO IT */
             CHGVAR     VAR(&NUMQHOUR) VALUE(&CURQHOUR)
             CHGVAR     VAR(&NUMQHOUR) VALUE(&NUMQHOUR + &HOURADD)
             CHGVAR     VAR(&NXTQHOUR) VALUE(&NUMQHOUR)

/* CREATE THE NEXT SUBMIT TIME ONE HOUR FROM NOW */
             CHGVAR     VAR(&NXTSBMTIM) VALUE(&NXTQHOUR *CAT +
                          &NXTQMINUTE *CAT '00')

/* SUBMIT THE JOB WITH THE RUNTIME OF 5 MINUTES FROM NOW */
             SBMJOB     CMD(CALL PGM(PINGCL)) JOB(PINGCL) +
                          JOBQ(QS36EVOKE) SCDTIME(&NXTSBMTIM) +
                          MSGQ(*NONE)


ENDLOOP:

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-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.