DB2 Date Column - Displays Incorrect in view Data

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
nandha
Participant
Posts: 6
Joined: Wed Aug 31, 2005 4:51 pm

DB2 Date Column - Displays Incorrect in view Data

Post by nandha »

Hi:
I imported the metadata from DB2 tables in mainframe using the Plug IN DSDB2. I have a date field defined as
LAST_MAINT_DATE DATE,
in DB2.

Metadata also shows as
LAST_MAINT_DATE DATE, 10

When I view data , I am seeing values as "10767 (1997-06-23)" .

If I change the SQL Type to Char , then the data is displayed in YYYY-MM-DD format.

1. Should i define he metadata as Char , though it is date field ?
2. Is there any setting I am missing ?.

Searched the forum & manuals couldn't get help.

Thanks for your responses in advance.

Rgds,
Nandha
gradkarthik
Participant
Posts: 28
Joined: Fri Jul 29, 2005 3:51 pm
Location: Arizona, USA

Post by gradkarthik »

Hi Nandha,
From what i saw,
10767 is the internal representation of the date 1997-06-23 which datastage calculates when you use the iconv function.
check your code and see if you are using iconv anywhere to perform some conversion of your LAST_MAINT_DATE field.
gpatton
Premium Member
Premium Member
Posts: 47
Joined: Mon Jan 05, 2004 8:21 am

Post by gpatton »

One system I worked on with DB2 used char(10) as the definition for all date fields and Varchar(26) for timestamps with a format of YYYY-MM-DD hh:mm:ss.sssss

This works fine and is readily visible for debugging, but you must be consistent throughout the processing.
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

DB2 driver

Post by jdmiceli »

Howdy!

My understanding of the DB2 drivers are that they only display dates in the internal format when using View Data. If you want to see it differently then you would need to convert it using ICONV (I think). Also, you won't be able to do this in View Data of the driver, but you could place a derivation that will do it for you.

Bestest!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Ahhh, the DB2 plugin. It works differently from other stages like Oracle and ODBC. If the datatype is DATE, it automatically uses ICONV inside the stage. The only way to prevent this is to switch the metadata to CHAR, which relies on the NLS setting of the database for the format, or TIMESTAMP, which makes it look like an ISO date.

You'll have this same issue with the Informix and Sybase stages, both reading and writing.

Make sure when loading you change the metadata as well. I recommend always toggling the DATE to TIMESTAMP.
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
Post Reply