Hi all! (again) (and again)
(and thank you for your support) (again) (and again)
I have a hash file whith two fields. DATE and WORKING_DAY. Data appear like this:
"2004-01-22" "1"
"2004-01-23" "1"
"2004-01-24" "0"
"2004-01-25" "0"
"2004-01-26" "1"
"2004-01-27" "1"
By the other side a have an ODBC feeding 2 dates (initial date and final date). I have to compute (throught a routine i supose) the working_days between this two dates. I don't know how to attack the hash file.
In fact, if we were talking about SQL it would be something like this:
SELECT SUM(WORKING_DAY) WHERE DATE > INITIAL_DATE AND DATE <= FINAL_DATE.
Thank you all.
xcasals.
Routine against hash file (need dummie's explanation)
Moderators: chulett, rschirm, roy
Hmmm... I would think you could do it via your SQL statement if you accessed the hash file with a UV stage.
Also consider turning it around. Use the hash as a source and the ODBC information as lookups. Bring in everything from the hash and constrain it to the rows that fall between the two dates. Then pass things through an Aggregator and do the sum there. Maybe not appropriate for your problem, but a technique to consider. Sometimes people don't realize that hash files make perfectly good sources for jobs.
Also consider turning it around. Use the hash as a source and the ODBC information as lookups. Bring in everything from the hash and constrain it to the rows that fall between the two dates. Then pass things through an Aggregator and do the sum there. Maybe not appropriate for your problem, but a technique to consider. Sometimes people don't realize that hash files make perfectly good sources for jobs.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 385
- Joined: Wed Jun 16, 2004 12:43 pm
- Location: Virginia, USA
- Contact:
Perhaps, create a hash file whose key is date and whose data field is the number of working days since a specific start date. Now with two reads and a subtraction, you have your answer.
Otherwise, create a routine to count the number of work days between the two dates less weekends and holidays.
Otherwise, create a routine to count the number of work days between the two dates less weekends and holidays.
Chuck Smith
www.anotheritco.com
www.anotheritco.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
If you insist on doing it in code, and you want BETWEEN comparisons, why not use a B-tree file (Type 25) rather than a hashed file? Then you can skim left and right along the leaf nodes using the BSCAN statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.