View previous topic :: View next topic
|
Author |
Message |
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Hi,
Is there any function avaiable in Syncsort to calculate the date difference
from two file?
for eg file 1
20110926
file 2
20110925
output should be :
1 |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have two single-record datasets, each with a date on, and you'd like to calculate the difference with the answer as a number of days?
Would it help you to concatenate the datasets, so that the first record is from dataset 1 and the second from dataset 2? |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
Yes, I want the difference in number of days. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Blood-from-a-stone time :-)
I really understood the bit about you wanting days. What I was hoping to know were the answers to the other questions.
You have dates on two seperate datasets - how many records on each dataset?
Would it help you, ie would you then be able to proceed with the code, if both the dates were on the same dataset as seperate records, or have you no clue at all about how to do this? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Your first question
Quote: |
You have two single-record datasets, each with a date on, and you'd like to calculate the difference with the answer as a number of days? |
His reply
Quote: |
Yes, I want the difference in number of days. |
|
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
there are two diffrent PS and number of record in each PS is same.
for eg;
for eg file 1
date ID
20110926 ABC
20110901 XYZ
file 2 ID
20110925 ABC
20110830 XYZ
output should be :
1
2
there can be many record and input is also have a key field on which the match will be done. in this case ID is the key |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
&holy &shit... why did You reply yes to the question
Quote: |
You have two single-record datasets, each with a date on, and you'd like to calculate the difference with the answer as a number of days? |
after more than 100 posts You should know how to post better ! |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
enrico-sorichetti wrote: |
Your first question
Quote: |
You have two single-record datasets, each with a date on, and you'd like to calculate the difference with the answer as a number of days? |
His reply
Quote: |
Yes, I want the difference in number of days. |
|
Mmmm... at least I didn't get the pointers about how to ask a question properly...
My question can be answered "Yes", or it can be answered "No, I want this.." followed by a lucid explanation.
From "Yes" and a subset of my question associated with that, I have no further clue about the answer I actually want, which is whether there is one or more records on either of the datasets.
"Do you want salad and potatoes with your chicken?"
"Yes please".
"No, real coders don't do salad, but I do like potato".
"I'm sorry, I must have misspoken, I'd like fish, with some fresh pasta if that is possible".
"Yes, I want chicken".
The first three answers are a useful, the fourth gets nowhere. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
follow on ...
and please avoid to make people willing to help You look dumb |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
I thought that my question was clear enough. May be there is some problem in expressing. I will search the forum and see if i get any thing that can help me.
Thank you |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
the initial posts hinted two files with a single record and no key
as an hint
use the JOINKEYS to couple the records with the same key,
after that a date difference from two columns of the same record would me mopre than enough |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Your question is clear enough if all the information that you know is known.
Let me try this:
I have a task whereby I have to find the difference in the dates between records on two different PS datasets. I need the difference as a number of days.
The records each have a key. The date is in the form CCYYMMDD.
I can do all the coding to match the records in the datasets, but I don't know how to do the date subtraction with the dates in two different files.
Does anyone have any pointers, please? I can/cannot use xTOOL. I can/cannot use more than one STEP. I do/do not have a SyncSort manual available. (delete as applicable). |
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
I know how to use join keys. I have written that much of code to match the file on the key feild position, while writing the outrec I am not able to calcluate the difference. I did some search on DATE in syncsort but I didnt get any info that can help me.
current code(sysin) i am able to write till reformat fields. |
|
Back to top |
|
|
|