View previous topic :: View next topic
|
Author |
Message |
Praveen Bhat
New User
Joined: 26 Aug 2008 Posts: 7 Location: Chennai
|
|
|
|
Hello,
I need to insert a delay of 1 mili sec in a batch program. How exactly and efficiently could this be done?
Tried using the below:
Code: |
ACCEPT WS-TIME1 FROM TIME
MOVE ZEROES TO WS-TIME2
PERFORM UNTIL WS-TIME2 > WS-TIME1 + 500
ACCEPT WS-TIME2 FROM TIME
IF WS-TIME1-TEXT(1:2)='23' AND WS-TIME2-TEXT(1:2)='00'
MOVE WS-TIME2 TO WS-TIME1
END-IF
END-PERFORM
|
but TIME returns, say 12:14 PM as 12140000, in HHMMSSnn where the last two digits 'nn' are 1/100 of a second. This does not let me have a delay in terms of 1/1000 of second!
Thanks in advance,
Praveen |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Praveen and welcome to the forums,
What do you want to accomplish?
If is very bad practice to try to delay an executing program. . . |
|
Back to top |
|
|
Praveen Bhat
New User
Joined: 26 Aug 2008 Posts: 7 Location: Chennai
|
|
|
|
Hello D,
Scenario is this. I am getting a message for a MQ, if no message found in the queue, wait for 1 ms and retry once again before giving up.
I clearly understand that delaying an executing a program will impact the turnaround time, but rather than flagging error when no message is found in the queue, it would be better to retry and then flag error.
Regards,
Praveen |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
use the MQS WAIT function. and why would no message be an error anyway? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
A better approach may be to schedule a job to process the queue every n minutes. This job would read all of the queued entries and terminate when there were no more to process.
The next execution would process the newly queued entries.
Depending on timing/volumes, you could choose an optimal interval to start the new run.
A variaton of that i've seen a few places is that the job processes only one message terminates and sends itself back thru the internal reader. When there is no message, the process terminates without re-submittiing itself and the next execution is from the schedule.
Neither requires trying to issue your own delay. |
|
Back to top |
|
|
Praveen Bhat
New User
Joined: 26 Aug 2008 Posts: 7 Location: Chennai
|
|
|
|
No message is definitely an error. But I don’t want to flag it too early, even before the message is committed in the MQ, that’s all.
How to use MQS WAIT? |
|
Back to top |
|
|
Praveen Bhat
New User
Joined: 26 Aug 2008 Posts: 7 Location: Chennai
|
|
|
|
Thanks D. |
|
Back to top |
|
|
|