Concatenating Timestamp With a Sequential file
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 38
- Joined: Mon Feb 27, 2006 10:34 pm
- Location: Chennai
- Contact:
Concatenating Timestamp With a Sequential file
HI! All
I have a job which is loading data in to a sequential file ,This jobs runs 5 times a day. I want to generate a file with filename concatenated with timestamp every time the job finishes. Therefore I need to generate five files a day for example: "OrderInvoice 23/06/2006 00:00:00 AM"
Is there any method in DataStage or through UNIX to achieve it? Please help me out/
Thanks in advance!
Tausif
I have a job which is loading data in to a sequential file ,This jobs runs 5 times a day. I want to generate a file with filename concatenated with timestamp every time the job finishes. Therefore I need to generate five files a day for example: "OrderInvoice 23/06/2006 00:00:00 AM"
Is there any method in DataStage or through UNIX to achieve it? Please help me out/
Thanks in advance!
Tausif
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
Cognizant technologies,Perungudi
Chennai
Re: Concatenatnating Timestamp With a Sequential file
In the sequential file stage, use macro DSJobStartTimeStamp
OrderInvoice#DSJobStartTimeStamp#.txt
I am not exactly sure if this functionality is available in version 5.
OrderInvoice#DSJobStartTimeStamp#.txt
I am not exactly sure if this functionality is available in version 5.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 38
- Joined: Mon Feb 27, 2006 10:34 pm
- Location: Chennai
- Contact:
-
- Participant
- Posts: 38
- Joined: Mon Feb 27, 2006 10:34 pm
- Location: Chennai
- Contact:
Offcourse you wont be able to open it. The timestamp will have a space in between and unix doesnt like that.
Use this
Use this
Code: Select all
OrderInvoice_#DSJobStartDate#_#DSJobStartTime#.txt
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 38
- Joined: Mon Feb 27, 2006 10:34 pm
- Location: Chennai
- Contact:
Says who.opdas wrote:It may be because of the timestamp format eg "14:44:36" as unix has problem creating/reading file having ":" in the name
The problem is not with the charcter ":" but instead a space.
The macro "DSJobStartTimestamp" creates a date part and a time part with a space between the date and time part. That is the culprit. Thats why i gave an alternative solution without any space in between.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Are you trying to open the file via seq. file stage?
If yes then it wont open it because you have a macro in the name. YOu need to go at the unix level and do a cat of the file.
And also, just for your own satisfaction, at the unix level type
touch 22:22 and see that it does get created.
If yes then it wont open it because you have a macro in the name. YOu need to go at the unix level and do a cat of the file.
And also, just for your own satisfaction, at the unix level type
touch 22:22 and see that it does get created.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
There is no problem with either spaces or colons in UNIX pathnames. And using the DSJobStartTimestamp macro in a sequential filename works fine as I just built a quick test job to verify that fact for myself. It will also 'open in the sequential file stage' (aka View Data) just fine as well with the macro in the name.
So, bottom line, something else is wrong. Something in your file or in what you are doing or with your version of DataStage... who knows, but it ain't the macro per se.
Post some details for us so we no longer need to guess. What operating system? How exactly are you 'opening' the file? Paste the entire error here, don't hand type it, don't paraphrase it. Let's see what happens next.
ps. My test was done using 7.5.1A on H-PUX. Mr 'me too' Kumar_j - what version of DataStage are you running?
So, bottom line, something else is wrong. Something in your file or in what you are doing or with your version of DataStage... who knows, but it ain't the macro per se.
Post some details for us so we no longer need to guess. What operating system? How exactly are you 'opening' the file? Paste the entire error here, don't hand type it, don't paraphrase it. Let's see what happens next.
ps. My test was done using 7.5.1A on H-PUX. Mr 'me too' Kumar_j - what version of DataStage are you running?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Even i built a test job yesterday with DSJobStartTimestamp, but i never hit view data. I went at the unix level and did a cat.
It wasnt reading it due to the space between the Date and Time.
I just ran the job again and hit view data, and yes you are right, it is able to view data.
But i would still advise to use DSJobStartDate and DSJobStartTime seperately to avoid getting that pesky space in between. Unix file names with spaces, not good.
It wasnt reading it due to the space between the Date and Time.
I just ran the job again and hit view data, and yes you are right, it is able to view data.
But i would still advise to use DSJobStartDate and DSJobStartTime seperately to avoid getting that pesky space in between. Unix file names with spaces, not good.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.