IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to insert time delay in COBOL batch program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Praveen Bhat

New User


Joined: 26 Aug 2008
Posts: 7
Location: Chennai

PostPosted: Tue Aug 26, 2008 10:30 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 10:39 am
Reply with quote

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
View user's profile Send private message
Praveen Bhat

New User


Joined: 26 Aug 2008
Posts: 7
Location: Chennai

PostPosted: Tue Aug 26, 2008 10:49 am
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 26, 2008 10:55 am
Reply with quote

use the MQS WAIT function. and why would no message be an error anyway?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Aug 26, 2008 10:59 am
Reply with quote

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
View user's profile Send private message
Praveen Bhat

New User


Joined: 26 Aug 2008
Posts: 7
Location: Chennai

PostPosted: Tue Aug 26, 2008 11:04 am
Reply with quote

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
View user's profile Send private message
Praveen Bhat

New User


Joined: 26 Aug 2008
Posts: 7
Location: Chennai

PostPosted: Tue Aug 26, 2008 11:06 am
Reply with quote

Thanks D.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top