Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to insert time delay in COBOL batch program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to insert time delay in COBOL batch program
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

Site Director


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

PostPosted: Tue Aug 26, 2008 10:39 am    Post subject:
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    Post subject: Reply to: How to insert time delay in COBOL batch program
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: 6967
Location: porcelain throne

PostPosted: Tue Aug 26, 2008 10:55 am    Post subject:
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

Site Director


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

PostPosted: Tue Aug 26, 2008 10:59 am    Post subject:
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    Post subject: Reply to: How to insert time delay in COBOL batch program
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    Post subject: Reply to: How to insert time delay in COBOL batch program
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts DSNACCOX (can it be run on 1 db/ts, t... SRICOBSAS DB2 3 Sat May 06, 2017 12:59 am
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us