Page 1 of 1

StringtoDate Conversion

Posted: Mon Dec 27, 2004 6:04 pm
by als110
I have a job that converts a char of length 8 to a date. After debugging I realized that some of my input data comes in as a high value of 99999999. I first need to convert those fields that come in as that high date to our default of 99991231 in a char or varchar format. The way i accomplished this was to fist have the following if statement in a stage variable:

if TrimtoXfrm.BILL_UNIT_TRM_DT = '99999999' then '99991231' else TrimtoXfrm.BILL_UNIT_TRM_DT

then i took this stage as name TermDt and loaded it to the output as

StringtoDate(TermDt, "%yyyy%mm%dd") and this only works for records that do not contain the high date. I have used stringtodate in other fields and it works fine as just an input into the function and an output to a date. If I go to unix and cat the output file the term date field is populated fine if it fails the if logic and populated to ********** if it has pasted the if logic and populated to the high date.

I also created another job to just test the stage variable where i just populated the field to a string and the high date if logic works, if the value comes in as 99999999 it is converted to 99991231 and if it is not this then it just passes the incoming string through. Does anyone have any suggestions as to how I can get this to work with my stringtodate function