Formatting a Date to write to a sequential file

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
kuppleca
Participant
Posts: 6
Joined: Tue Dec 27, 2005 1:00 pm

Formatting a Date to write to a sequential file

Post by kuppleca »

I am attempting to write a date, as well as other information, from an Oracle table to a seq file.

The field is defined as DATE in the Oracle table and VARCHAR(10) on the seq file. Without any date functions, etc., the date written to the file is the internal date, for example, 17995. When I use the DATE.TAG function, I get "2017-04-07", instead of "2007-04-17". I am inserting the date into the BATCH table by using "to_date('#parmDATECARDDT#', 'YYYY-MM-DD).

INSERT INTO BATCH(batch_oid, batch_dte, input_src, input_batch_type)
VALUES (9998, TO_DATE('#parmDATECARDDT#', 'YYYY-MM-DD'),
'#parmInputSource#','Q')

I can select the field from teh database using:
to_char(batch_dte, 'YYYY-MM-DD'),


Any help would be appreciated.
Thanks.

Curtis
Application Technical Engineer
kuppleca
Participant
Posts: 6
Joined: Tue Dec 27, 2005 1:00 pm

Post by kuppleca »

I looked some more on the forum and found my answer!!!! :)

I did a to_char(batch_dte, 'YYYY-MM-DD') in the SQL to obtain the field, then in the Transformer, I did a DATE.TAG(batch_dte) as the derivation.

The date came out in the file as 2007-04-17, instead of 2017-04-07.

Thanks to the forum and all its postings. It sure helped!!!!
Thanks.

Curtis
Application Technical Engineer
Post Reply