Page 1 of 1

Date Conversion Problem in Modify Stage

Posted: Tue Dec 03, 2013 4:28 pm
by william.eller@ed.gov
I have a 3 field sequential file:

Code: Select all

Extract_date CHAR        8 
ID           CHAR       11
NAME         NVarChar   30
Modify stage converts Extract_date to Date with: Date_From_String(EXTRACT_DATE)

Date format String = %yyyy%mm%dd

input record like: 20131121+0000448416CHARLOTTESVILLE<spaces to rec end>

Error Says:
Unhandled conversion error on field Extract_Date from string[8] to dest. type DATE. Source value "0131121+"

Looks as if the reader starts at position 2 of the record. Please help

=======================
Problem solved - The input file was created with a format other than ISO8859-1. When recreated transferred (as binary) to datastage with source parm set to "EBCDIC input (IBM500)" and target set to ISO8859-1 the alignment worked fine. Thanks

Posted: Tue Dec 03, 2013 5:06 pm
by chulett
Looks to me like you are dealing with a signed CHAR. Sorry but I have no documentation here - is there some way to specify it is unsigned?

Re: Date Conversion Problem in Modify Stage

Posted: Tue Dec 03, 2013 7:22 pm
by pavi
Is this a fixed width file or a delimited file?
One option I see from your data is take the whole string in one column and use substring to strip first 8 charecters and then convert it from string to date

Signed Quote

Posted: Tue Dec 03, 2013 7:55 pm
by william.eller@ed.gov
The numeric is read as a char and, converted to a signed numeric in the modify stage. The issue is that the date fields (which is read as a string) starts at the 0 of 2013 instead of the 2

Re: Date Conversion Problem in Modify Stage

Posted: Tue Dec 03, 2013 7:59 pm
by william.eller@ed.gov
pavi wrote:Is this a fixed width file or a delimeted file?
One option I see from your data is take the whole string in one column and use substring to strip first 8 charecters and then convert it from string to date
Fixed width - record length 49 - what stage would I use to substring and parse the record? - thanks

Posted: Tue Dec 03, 2013 8:17 pm
by chulett
The Column Import stage would be one choice. But it looks like your file is being misread by the Sequential File stage rather than anything the Modify may be doing, so I'm not sure going that route would fix anything.