× 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: "Ken Sims at SWS Nevada" <ken.sws@xxxxxxxxx>
  • Date: Wed, 29 Sep 1999 11:38:14 -0700

Hi Bruce and the gang -

>Date: Wed, 29 Sep 1999 13:00:22 -0400
>From: "R. Bruce Hoffman, Jr." <rbruceh@ibm.net>
>Subject: Re: Whats the best way to run a CL every 30 min

>Close. Just create a data queue. Call the QRCVDTAQ command with a 30
>second wait period. At the end of 30 seconds, the receive program will
>return to your CL program. Do what you need and then loop back to the
>QRCVDTAQ call.
>
>PGM
>DCL &data *char 1
>DCL &datalen *dec (5 0)
>DCL &wait *dec (5 0) value(30)
>
>@LOOP: call qrcvdtaq('dqname' 'dqlibrary' &datalen &data &wait)
>        .
>        .
>goto @loop
>ENDPGM
>
>Why loop? It prevents having to start and stop the job every 30 seconds.
>Saves resource, performs better.
>
>Note that the variable &datalen will always return 0 (zero) as there is
>no data actually received. This could be used as a way to terminate the
>program. Send data to the data queue and leave the loop if the length is
>greater than 0.

I do something very similiar, except that I use a message queue and a
RCVMSG with a WAIT of the appropriate length.  It's easier to do a
SNDMSG than to call the QSNDDTAQ API.

But I take it a step further, and have the program interpret the message
data as a command.  For example, SNDMSG ENDJOB NVSYSMON will cause my
system monitor to end.  HLDJOB will cause the program to continue running
but not take any action.  RLSJOB will cause the program to resume normal
operation.  FRCJOB causes the program to immediate perform its function.
RESTART causes the program to submit another copy of itself and end.  This
is handy if I want program changes to be picked up or otherwise want
everything to be fresh.

Just to throw in another goodie ...

I actually have the WAIT time much less than the actual time between cycles,
so that the program can detect a controlled end and shut itself down.  The
program keeps count of how many times it has been through the RCVMSG wait
since the last time it did a full cycle of processing, and does the full
cycle when appropriate.

In the circumstances being discussed, I'd probably have the WAIT at 60
seconds, and do the full processing on every 30th time through.

Ken
Southern Wine & Spirits of Nevada, Inc.

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


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.