Date Conversion Problem in Modify Stage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
william.eller@ed.gov
Participant
Posts: 19
Joined: Fri Aug 03, 2012 11:06 am

Date Conversion Problem in Modify Stage

Post 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
Last edited by william.eller@ed.gov on Wed Dec 04, 2013 3:03 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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?
-craig

"You can never have too many knives" -- Logan Nine Fingers
pavi
Premium Member
Premium Member
Posts: 34
Joined: Mon Jun 03, 2013 2:34 pm

Re: Date Conversion Problem in Modify Stage

Post 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
william.eller@ed.gov
Participant
Posts: 19
Joined: Fri Aug 03, 2012 11:06 am

Signed Quote

Post 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
william.eller@ed.gov
Participant
Posts: 19
Joined: Fri Aug 03, 2012 11:06 am

Re: Date Conversion Problem in Modify Stage

Post 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply