I want toconvert Nondelimited date to DS internal Format
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 14
- Joined: Mon May 23, 2005 9:15 pm
I want toconvert Nondelimited date to DS internal Format
My Input date is in the format YYYYMMDD, it is non delimited, I am trying to validate the input date with the DS Transform DateGenericIsDate, but this transform will accept the date in the DS internal format, so I am trying to convert the input date(YYYYMMDD) into DS internal format using DS transform DateGenericToInternal, but this DSTransform is not converting successfully.
Please suggest what I can do.
Please suggest what I can do.
You can perform a ICONV(In.DateString[1,4]:'-':In.DateString[5,2]:'-':In.DateString[7,2],'D4-ymd') to do this.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Re: I want toconvert Nondelimited date to DS internal Format
what - Arnd suggested will work I have done the same in my project getting data from MainFrame
Thank you
Thank you
ram1899
-
- Participant
- Posts: 14
- Joined: Mon May 23, 2005 9:15 pm
Well, you need to see what the routine DateGenericIsDate() does; I don't know what sort of date it expects as an input, but the ICONV() function I gave you returns an integer internal date - which is what you asked for.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Nah, it's easier than any of that because Iconv() is really clever. All you need is
Code: Select all
Iconv(InLink.TheDate, "DYMD")
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.
-
- Participant
- Posts: 14
- Joined: Mon May 23, 2005 9:15 pm
Yes, I think there is some problem with the DSTransform DateGenericIsDate.Even I am trying the following condition, it is returning ED001.
If Not(DateGenericIsDate(Date() )) Then "ED001" Else " OK"
Can anyone please give me some idea to validate a YYYYMMDD string.To check whether it is correct date or not.
If Not(DateGenericIsDate(Date() )) Then "ED001" Else " OK"
Can anyone please give me some idea to validate a YYYYMMDD string.To check whether it is correct date or not.
december786,
if you want a 1-liner you could use
This is because an unsuccessful ICONV/OCONV returns the original string. It is much better to use a short routine and get the value of STATUS() to find out why a conversion didn't work.
I did find the DateGenericIsDate transform (I had looked at the routines, but not the transforms) and it expects a string input date, not a DataStage internal format one; thus it is working just as expected.
if you want a 1-liner you could use
Code: Select all
IF(ICONV(InLink.TheDate, "DYMD")=InLink.TheDate)THEN 'Bad Date' ELSE 'Good Date'
I did find the DateGenericIsDate transform (I had looked at the routines, but not the transforms) and it expects a string input date, not a DataStage internal format one; thus it is working just as expected.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
Just had to point out,
If you look at the underlying routine, namely DateGenericToTimeStamp, it is not expecting date in the DS internal format, it is expecting iether a julian date, or one of several date formats, CCYYMMDD being one.
I did the following in a routine, and it works fine:
Regards,
If you look at the underlying routine, namely DateGenericToTimeStamp, it is not expecting date in the DS internal format, it is expecting iether a julian date, or one of several date formats, CCYYMMDD being one.
I did the following in a routine, and it works fine:
Code: Select all
Deffun isDate(x,y) Calling "DSX.DATEGENERICTOTIMESTAMP"
If isDate(Arg1,1)="" Then
Ans=@False
End
Else
Ans=@True
End
Precious
Mosher's Law of Software Engineering: Don't worry if it doesn't work right. If everything did, you'd be out of a job.
Mosher's Law of Software Engineering: Don't worry if it doesn't work right. If everything did, you'd be out of a job.
-
- Participant
- Posts: 14
- Joined: Mon May 23, 2005 9:15 pm