Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
This topic is locked: you cannot edit posts or make replies. 00D3003B - time outs in DB2 when invo... chavinash2004 DB2 2 Mon Oct 09, 2017 4:39 pm
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us