cyymmdd to timestamp

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

srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Code generation is fine but when you try to execute the jcl it gives the error of invalid casting. If you see the documentation of data type definitions and mappings, mapping date to timestamp and vice versa is invalid.
Thanks
srikie
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

One part of the documentation says the 'DSC2TS' RTL function expects the standard internal DataStage timestamp format. Then it says "(The separator characters need not be dashes and periods.)" It doesn't say anything about the colon (:) separators. Did you try the DataStage timestamp format?

I would suggest adding a "debug" file to check that the concatenation is working as you expect. Add an extra fixed-width flat file output stage and map your concatenated timestamp (before conversion by DS) and the timestamp (after conversion by DS) as two of the columns in the flat file.

Mike
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Thanks Mike I would try that out.Yes, I tried Data stage timestamp internal format it dint work either.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Srikie,

Can you try inserting your system date as default into that column. This will first prove that the column can hold.

Next, use the date format and use the 'date format' of the timestamp in the target field. This will enable DataStage to trigger the conversion by itself. I assume you were trying that earlier.

Can you say what happens if you insert a date without a time in that field.

CAST function is internal to DB2. COBOL will only consider the value as a string and pass it directly to DB2 to prepare and execute. So as long as you can try the double-cast successfully in DB2 via its client, it must work from DataStage generated COBOL.
srikie
Participant
Posts: 58
Joined: Thu Oct 14, 2004 4:19 pm

Post by srikie »

Thanks everyone.I think I nailed the problem down. I dint validat ethe date before casting onto timestamp. Now its workin fine.
Thanks once again
Post Reply