Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ghost hour in COBOL

Status
Not open for further replies.

Crox

Programmer
Apr 3, 2000
893
NL
Do your programs run at midnight? Do they use date and time seperately. Than an error can occur at this ghost hour:


regards,

Crox
 
Easy solution for the problem

accept t1 from time

accept d1 from date

accept t2 from time

accept d2 from date

if t2 > t1
use d1
use t2
else
use d2
use t2
end if


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
With the current cobol you would use function current-time, which gives the combination of time and date, so that is easy.

The case is if companies are going to be 7 days x 24 hours online using their normal systems, they can have trouble with such ghost transactions. So some of them want to repair them.

By the way, I don't think your solution will work in all situations. Your d2 date can be the newer one.

If you want to solve this the old way, you should check if your time was taken between two accepts of the SAME dates. If it is not, you simply take the newest date and accept the time again in which case you assume that your accept of the time will happen within 24 hours.

 
You are right, I forgot that both times could be equal.

if t2 >= t1
use d1
use t2
else
use d2
use t2
end if

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
I don't know if this is relevant, but I've had wierd situations sometimes where I'd do an accept time before and after a program ran and the after time would be BEFORE the before time.
 
Rm/Cobol (version 7 and above if i remember correctly) supports
Code:
ACCEPT FROM DATE-AND-TIME
where you get both date and time with a single accept, so there is no chance for such ghost hour errors.

Theophilos.

-----------

There are only 10 kinds of people: Those who understand binary and those who don't.
 
That is not COBOL. That is a Rm extension. And Rm is performing about 3000 times slower than CA-REALIA as I have noticed in the past so that is not an option. It will also not work on the mainframe. [sadeyes]

If you have a real and not too old COBOL compiler, you can use FUNCTION CURRENT-DATE. [sunshine]

In fact this problem is not about how you can avoid the problem. The case is how can you solve this problem when it is in your mainframe cobol system with millions of lines of code and when you want to let the system work 24 hours a day. Then you need a solution that you can handle. If you want to solve this by hand, you have an other Y2k problem which is a little bit expensive.... That is why an automated approach is in fact very interesting! Also... what is the fun to do this by hand....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top