Concatenating Timestamp With 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

mdtauseefhussain
Participant
Posts: 38
Joined: Mon Feb 27, 2006 10:34 pm
Location: Chennai
Contact:

Concatenating Timestamp With a Sequential file

Post by mdtauseefhussain »

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
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Re: Concatenatnating Timestamp With a Sequential file

Post by DSguru2B »

In the sequential file stage, use macro DSJobStartTimeStamp
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.
mdtauseefhussain
Participant
Posts: 38
Joined: Mon Feb 27, 2006 10:34 pm
Location: Chennai
Contact:

Post by mdtauseefhussain »

I tried with that Macro ,but just that Macro name is coming not the time satmp
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Opps, sorry, its with a small 's' in Timestamp.
try
OrderInvoice#DSJobStartTimestamp#.txt
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
mdtauseefhussain
Participant
Posts: 38
Joined: Mon Feb 27, 2006 10:34 pm
Location: Chennai
Contact:

Post by mdtauseefhussain »

HI!

iam able to create the file with the required file name but iam not able to open it
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You might want to explain that a wee bit more. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Offcourse you wont be able to open it. The timestamp will have a space in between and unix doesnt like that.
Use this

Code: Select all

OrderInvoice_#DSJobStartDate#_#DSJobStartTime#.txt
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
mdtauseefhussain
Participant
Posts: 38
Joined: Mon Feb 27, 2006 10:34 pm
Location: Chennai
Contact:

Post by mdtauseefhussain »

When i try to open the file iam getting this error "Encountered one error during transfer"
Mohammed Tausif Hussain Sheikh
Cognizant technologies,Perungudi
Chennai
kumar_j
Participant
Posts: 45
Joined: Mon Nov 28, 2005 2:43 am

Post by kumar_j »

mdtauseefhussain wrote:When i try to open the file iam getting this error "Encountered one error during transfer"

Same error for me too'
what can be the reason for this
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Post by opdas »

It may be because of the timestamp format eg "14:44:36" as unix has problem creating/reading file having ":" in the name
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

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
Says who.
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.
opdas
Participant
Posts: 115
Joined: Wed Feb 01, 2006 7:25 am

Post by opdas »

DSguru2B wrote: Thats why i gave an alternative solution without any space in between.
The alternative solution without space also throws the same error
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: 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.

:idea: 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
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply