Fuction

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
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Fuction

Post by fmartinsferreira »

Hi!

My imput in Transformer is '20060413', this is a date in the format(YYYYMMDD). But in some cases I receive '00000001' that is a invalid date.

Well, I would like to make a server routine that when receive the imput check if is a valid or invalid date.

Regards,

Fernando Martins
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Consider writing a date validation function with range checking, or use a TIME dimension table and validate every date.
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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The Iconv and Oconv functions that do date transformations also return status codes telling if the conversion was successful, successful with warnings or unsuccessful. Using a mask of yyyymmdd the value of "00000001" would return an error, while "00000101" is a valid date.
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Post by fmartinsferreira »

Thank you every body, but I preferred to make a server routine.
It is in a version 1.0 but work in some cases. :roll:

Follow the code.

DD=Data[8, 2]
MM=Data[6, 2]
AA=Data[2, 4]
RETORNO=Data[1, 9]

If (DD > 0 AND DD < 32) AND (MM > 0 AND MM < 13) AND AA > 1 Then RETORNO=RETORNO
Else RETORNO="000010101"

Ans=RETORNO

Best Regards,

Fernando Martins
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you really working with a nine character string here? If you are using a five digit year, then the substring extractions will need to be changed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
fmartinsferreira
Participant
Posts: 142
Joined: Wed Mar 24, 2004 10:51 am
Location: Brazil

Fuction

Post by fmartinsferreira »

Sorry :oops: ,

I'm working with 8 character.

Regards,

Fernando
ray.wurlod wrote:Are you really working with a nine character string here? If you are using a five digit year, then the substring extractions will need to be changed. ...
Post Reply