String to Date

Archive of postings to DataStageUsers@Oliver.com. This forum intended only as a reference and cannot be posted to.

Moderators: chulett, rschirm

Locked
admin
Posts: 8720
Joined: Sun Jan 12, 2003 11:26 pm

String to Date

Post by admin »

First off, it's best to start a new email rather than reply to an old one
when the subject is completely different.

To take a date string and convert it into a specific date format, check your
online help for ICONV and OCONV. They are typically used in pairs, the first
converts a string into the Internal format that DataStage uses, and the
second then takes that internal format and creates the specific Output
format you require. The STATUS function can also be used to check to see if
the conversion was successful, ie - the date was valid or in the expected
format. Both ICONV and OCONV make use of 'masks' to define the format that
they use and all of this can be wrapped up nicely in a Routine to make it
more robust. Sounds like you may need to make sure you are using the correct
masks for both functions and that it is coming in in the format you are
expecting.

It's all spelled out pretty well in the online help, check it out.

-craig

-----Original Message-----
From: Nibha Nanda [mailto:nibha_nanda@tcscal.co.in]
Sent: Thursday, January 15, 2004 7:36 PM
To: datastage-users@oliver.com
Subject: Re: x$x variables


Hi all
In a transformer one of the field value is a result of oconv function.
The target table is a date field with 'YYYY-MM-DD' format. The error we are
getting is unable to convert a string to a date in the transformer. Please
can you suggest a method in datastage to convert a string to a date in
server job.

Thanks
Nibha

[snip]
<b>PLEASE READ</b>
Do not contact admin unless you have technical support or account questions. Do not send email or Private Messages about discussion topics to ADMIN. Contact the webmaster concerning abusive or offensive posts.
Locked