To Append timestamp to file name:filename.MMDD.HHMM

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
seemamone
Participant
Posts: 9
Joined: Thu Dec 20, 2007 9:51 am
Location: India

To Append timestamp to file name:filename.MMDD.HHMM

Post by seemamone »

Hi,
We have a requirement to append timestamp of particular format
MMDD.HHMM to the file name.

Due to performance issues, we have to avoid using unix-scripting/routine for this purpose.

Any idea for adding this timestamp, in the same job,while the file is created, would be appreciated.

Cheers!
Seema
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

There would be no 'performance issue' with doing this in a script or after-job routine. :?

To do it in the job it must be a job parameter, then you can use it directly in the filename.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: To Append timestamp to file name:filename.MMDD.HHMM

Post by ray.wurlod »

seemamone wrote:Due to performance issues, we have to avoid using unix-scripting/routine for this purpose.
Who said?
Ask someone who knows what they're talking about.

You ultimately have to execute a single UNIX mv command, irrespective of where you do it. As Craig said, there is no "performance issue".

Indeed, the overhead of not using a script is likely to be greater, since you can use the UNIX date command in the same command to give you your file name suffix.

Code: Select all

mv filename filename.`date "+%m%d.%H%M"`
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
seemamone
Participant
Posts: 9
Joined: Thu Dec 20, 2007 9:51 am
Location: India

DS command to format TIMESTAMP to <MMDD>.<HHMM>

Post by seemamone »

thanks for the reply to my earlier post:)
Do we have a DS command to translate the timestamp value as per our requirement, e.g : <MMDD>.<HHMM>

thanks in advance
Seema
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Substring ( [] ) or OConv pairs with the proper coversion codes & masks, then concatenate with a dot between would do the trick. Assuming an ISO standard timestamp format:

Code: Select all

Convert("-","",YourTimestamp)[5,4] : "." : Convert("-","",YourTimestamp)YourTimestamp[10,4]
One example. You could also substring out the two parts with the dashes, concatenate them then do a 'post' convert to remove them. Always more than one way to skin the cat, as they say. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
seemamone
Participant
Posts: 9
Joined: Thu Dec 20, 2007 9:51 am
Location: India

Post by seemamone »

i used left/right function in the derivation for calling the TIMESTAMP parameter in main sequence calling the job and it worked!!
phew, it was not that tough..but writing here, helped me develop this faster!!
u guys rock!!
this was my 1st post and i am already finding it so useful!!!
Seema
jdmiceli
Premium Member
Premium Member
Posts: 309
Joined: Wed Feb 22, 2006 10:03 am
Location: Urbandale, IA

Post by jdmiceli »

Welcome aboard and we're glad your first experience was a positive one!

Merry Christmas!
Bestest!

John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services


"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
Post Reply