conversion

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

India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

conversion

Post by India2000 »

how to conevrt 020802 usign DS to orcale date?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Like normal - an Iconv/OConv pair (or substring / concatenation) to get it into a standard format and then a TO_DATE() with a matching format mask in your target SQL.
-craig

"You can never have too many knives" -- Logan Nine Fingers
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

chulett wrote:Like normal - an Iconv/OConv pair (or substring / concatenation) to get it into a standard format and then a TO_DATE() with a matching format mask in your target SQL. ...
I dont see nay functions To_DATE in datastage
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

To_date function is available in Sql and not in DataStage.
You are the creator of your destiny - Swami Vivekananda
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

chulett wrote:... and then a TO_DATE() with a matching format mask in your target SQL. ...
...in your target SQL is what Craig meant.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

vivekgadwal wrote:
chulett wrote:... and then a TO_DATE() with a matching format mask in your target SQL. ...
...in your target SQL is what Craig meant.

I got where is it but How do I mask it?
Last edited by India2000 on Mon Sep 27, 2010 2:23 pm, edited 1 time in total.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

Write a User-defined SQL query to do the Date masking.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or let the stage generate the SQL. If your data types are correct in the job, it will automatically use a TO_DATE() in the generated sql.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What does 020802 actually mean? Is it YMD, DMY, MDY format? Is it a Julian date of some kind?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

ray.wurlod wrote:What does 020802 actually mean? Is it YMD, DMY, MDY format? Is it a Julian date of some kind? ...
its in MMDDYY format. SQL it generates asTO_DATE(:5, 'DD-MON-YY'), let me know how to make it work..I dont get anything to the oracle db.

Thanks
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Convert it into the format it is expecting.
-craig

"You can never have too many knives" -- Logan Nine Fingers
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

India2000 wrote:
ray.wurlod wrote:What does 020802 actually mean? Is it YMD, DMY, MDY format? Is it a Julian date of some kind? ...
its in MMDDYY format. SQL it generates asTO_DATE(:5, 'DD-MON-YY'), let me know how to make it work..I dont get anything to the oracle db.

Thanks
oconv(iconv( 020802,'d6']'),'d-dmy[2,a3,2]')

what's wrong in this conversion with respect to the SQL given above?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

"d6" is not a valid argument for Iconv(). You need something like "DMDY". All date arguments for Iconv() and Oconv() must be in upper case.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps IConv(YourDate,'DMDY[2,2,2]') for the internal conversion part?
-craig

"You can never have too many knives" -- Logan Nine Fingers
India2000
Participant
Posts: 274
Joined: Sun Aug 22, 2010 11:07 am

Post by India2000 »

ray.wurlod wrote:"d6" is not a valid argument for Iconv(). You need something like "DMDY". All date arguments for Iconv() and Oconv() must be in upper case. ...
I changed it to Oconv( Iconv( Date,"D-MDY[2,2,4]"),"D-DMY[2,A3,2]") as per the sql generated to_date(:5,'DD-MON-YY') but still it doesnt work..where am I going wrong.. After Oconv i get the same value as it only with Iconv. ie in integer format
Last edited by India2000 on Mon Sep 27, 2010 10:52 pm, edited 1 time in total.
Post Reply