DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
This topic has been marked "Resolved."
Author Message
rumu
Participant



Joined: 06 Jun 2005
Posts: 282

Points: 2830

Post Posted: Mon Jan 21, 2019 11:48 am Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Unix
Hi All,

I have a requirement to convert input string to date fomat yyyymmdd.
Input string is coming as 'yymmdd' format. Ie if input data is 190110, output should be 20190110.

I used the following conversion:

Code:
DateToString( StringToDate(Lnk_TDCO.TRAIL_DATE,"%yy%mm%dd"),"%yyyy%mm%dd")


The out put I am getting as 19190110..The year is 1919 instead of 2019. How to rectify this?

_________________
Rumu
IT Consultant
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42923
Location: Denver, CO
Points: 221366

Post Posted: Mon Jan 21, 2019 3:41 pm Reply with quote    Back to top    

For one way, check here and then search for year_cutoff. Allows you to define what is also known as the "Century Pivot".

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
rumu
Participant



Joined: 06 Jun 2005
Posts: 282

Points: 2830

Post Posted: Tue Jan 22, 2019 7:02 am Reply with quote    Back to top    

Thanks Craig,

To use date tag, do I need to use basic transformer?

_________________
Rumu
IT Consultant
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42923
Location: Denver, CO
Points: 221366

Post Posted: Tue Jan 22, 2019 7:25 am Reply with quote    Back to top    

Nope, not at all.

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
rumu
Participant



Joined: 06 Jun 2005
Posts: 282

Points: 2830

Post Posted: Tue Jan 22, 2019 8:00 am Reply with quote    Back to top    

ok, then may be my expression is wrong hence getting parsing error.

If I want to extract cutoff year from the input field, I am using expression as below:

StringToDate(InputLink.Datestring,"%NNNNyy")

I am getting parsing error for this.

_________________
Rumu
IT Consultant
Rate this response:  
Not yet rated
chulett

Premium Poster


since January 2006

Group memberships:
Premium Members, Inner Circle, Server to Parallel Transition Group

Joined: 12 Nov 2002
Posts: 42923
Location: Denver, CO
Points: 221366

Post Posted: Tue Jan 22, 2019 8:06 am Reply with quote    Back to top    

I assume you need to replace NNNN with the actual year to use as the cutoff / pivot year.

_________________
-craig

The Old Ones were, the Old Ones are, and the Old Ones shall be. Not in the spaces we know, but between them. They walk serene and primal, undimensioned and to us unseen.
Rate this response:  
Not yet rated
rumu
Participant



Joined: 06 Jun 2005
Posts: 282

Points: 2830

Post Posted: Tue Jan 22, 2019 8:33 am Reply with quote    Back to top    

Thanks Craig. I set up cut off year as 2000 and received the desired output.

_________________
Rumu
IT Consultant
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours