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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Algorithm for calculating business-day aging?? 1

Status
Not open for further replies.

RICHINMINN

Programmer
Dec 31, 2001
138
0
0
I work in an IBM mainframe environment (z/OS, COBOL 2 and 3, DB2, etc.). I need to write a COBOL program to do an aging report of batches of data that are being processed. There are 4 steps that have to be completed, and these steps can span multiple days, though most data will complete all 4 steps within the same day. I need to see the batches that are not completely done, and how many business days it has taken them so far.

Does anyone have a handy algorithm for calculating the number of business days elapsed between, say, the current date, and the date that a batch of data most recently completed one of its 4 steps, which will, of course, take into account weekends and holidays?

The batch information is found on a DB2 table, with a timestamp field that is updated each time that the batch completes one of the four steps.

I realize that this description of the problem is a bit vague, but thanks for bearing with me.

Rich (in Minn.)
 
Marc,
Thanks for the links. The answer given in the thread is pretty much what I was thinking of doing. And that "SQL Cookbook" by Graeme Birchall has a ton of information in it! I've been browsing through it and have found a ton of techniques that I'm itching to try out (though nothing directly related to my data-aging scenario).

Thanks again!

Rich (in Minn.)
 
Rich,
Pleased to be of help!

The Graeme Birchall cookbook is a fantastic document that I was pointed to by members of the DB2 forum here a few years ago. He has built it up over many many years and is such a useful doc, that I find myself referring to it on a regular basis. Graeme, who I only know by browsing his site, lives on the Hudson river overlooking New York and he has take a number of photos of Manhattan over variosu periods of the year that are well worth checking out.

Sorry, I digressed!!

Marc
 
Yes I do have an algorithm that do aging (for AR). I will try to find my archives and if lucky I'll post it here. I did create an algorithm to extract aging, day of the month & week, beginning and end of months, etc.. Basically all I did (I think) is to convert the date and time into julian dates then into days then into hours then into minutes then into seconds
then into micro-seconds(this is to consider changing of the time at midnight).

So if you have two dates to calculate then convert them into
micro-seconds, get the difference and convert back into datetime format and you will get the exact difference in days,
hours, minutes and seconds.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top