Hi All,
In a sequence i am trying to calculate datetime in the format YYYYMMDD_HHMM and assign this to a variable and pass the variable to a job activity stage as a parameter.
The calculated value "YYYYMMDD_HHMM" will be appended as a suffix to an error file. So the error will have a name like Error_File_Table_YYYYMMDD_HHMM.txt
I tried using Oconv(date(),'YMD[422]'):'_':Oconv(time(),'MCN') to get this but all i get is number like this .. 17532231_7234.
or also, is there a way to calculate "YYYYMMDD_HHMM" inside the job itself and append the same to the error file..
Need help in this one ...
Need to Calculate date & time in the format YYYYMMDD_HHM
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 10
- Joined: Sun Jul 15, 2012 11:34 pm
- Location: Bangalore
Need to Calculate date & time in the format YYYYMMDD_HHM
Thanks & Regards
Suhel Khan
Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g
Suhel Khan
Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You need commas in the format specification for the Oconv() function, and then you need to remove the default delimiters. That is, you probably should use something like
There's no convenient way to generate this within the job itself, but a commonly used approach is to write to a generic file name then use an after-job subroutine (ExecSH or ExecSHSilent) to rename that file, using the date command to generate the suffix.
Code: Select all
Oconv(Date(), "DYMD[4,2,2]" : @VM : "MCN") : "_" : Oconv(Time(), "MT" : @VM : "MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 10
- Joined: Sun Jul 15, 2012 11:34 pm
- Location: Bangalore
Ray, Thanks for the reply..
I did come up with a similar solution after some trial and error.
I did come up with a similar solution after some trial and error.
Code: Select all
Oconv(Oconv(Date(), "DYMD[4,2,2]"),"MCN")) : "_" : Oconv(Oconv(Time(), "MT"), "MCN"))
Thanks & Regards
Suhel Khan
Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g
Suhel Khan
Env Info:
DataStage Version : 8.5
DSEngine Platform : Windows Server 2008 R2
DWH Platform : Oracle 10g