NO OF WEEKS

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
vinod111
Participant
Posts: 5
Joined: Wed Oct 05, 2005 8:52 pm

NO OF WEEKS

Post by vinod111 »

When I tried to find out no of weeks with the formula that is Current Date - Hiredate /7 it gave me same no of days in each column.. How would I do this? It seems it is not recognizing different hiredates in each column.. Please let me know how would I find the no of weeks
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

There are no datatypes in DS Server. You need to write a function to subtract dates. Better yet, have one that understands dates and time. Here's one I posted a long time ago:

viewtopic.php?t=85788

Create a function and paste this logic into it, it will do what you need most of the way. Have fun.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When you learned arithmetic at school, what did they teach you about precedence?

What's the difference between these two expressions?
  • CurrentDate - HireDate / 7

    (CurrentDate - HireDate) / 7
The second of these will provide what you seek provided both dates are in DataStage internal format.

However, the result will be a decimal number - that is, it may include a fractional number of weeks. Adjust using the Int() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not to derail this, but... :?

Ray, I could have sworn in the past you've said that DataStage was an odd duck in that it did not enforce any precedence when evaluating expressions? That it is, without parens, evaluated strictly from left to right. Am I mis-remembering?
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

That's correct, left to right when you don't have these ( guys ).
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

chulett wrote:Not to derail this, but... :?

Ray, I could have sworn in the past you've said that DataStage was an odd duck in that it did not enforce any precedence when evaluating expressions? That it is, without parens, evaluated strictly from left to right. Am I mis-remembering?
I was talking about logic, not arithmetic. Arithmetic follows the rules. Logic (stuff with AND and OR) runs left to right unless parentheses occur.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Ah. Thanks for the clarification... forgot the previous discussions were and/or related.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply