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

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

Post by chulett »

They work fine, you just need to know how to handle them. :wink:
-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 »

True. Very true.
Its just my personal rule of thumb, a space in a file name, a big no no.
Because once this file is built. If it needs to be accessed again in some other job, the sequential file wont read it then due to that pesky space. Or it can, am i missing something here ???
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 »

Hi,
I'm geting the following error at runtime when I use :

output__#DSJobStartDate#_#DSJobStartTime#.txt

Code: Select all

Sequential_File_2: When processing argument -fileWhen processing path: /home/dsetl01/my_prg/tmp/output_2006-07-13_19:23:44.txt is not a valid path name: Invalid hostname: /home/dsetl01/my_prg/tmp/output__2006-07-13_19
but works fine when use :

output__#DSJobStartDate#.txt

We are using AIX 5.3
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

DSguru2B wrote:Because once this file is built. If it needs to be accessed again in some other job, the sequential file wont read it then due to that pesky space. Or it can, am i missing something here ???
Yes. :wink:

The sequential stage can handle it just fine, it's the peoples that have the problem. Typically, you just need single quotes around the filename.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

opdas wrote:We are using AIX 5.3
Looks to be specific to AIX. :? Can you check with your UNIX sysadmins and find out if the colon is not allowed in a pathname? Or at least what characters are not allowed?

You might also try creating the file by hand at the command line, see if possibly it's an issue with your version of DataStage...
-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 »

If nothing works out, then just simply create the file output.txt and run an After Job Subroutine and do this

Code: Select all

mv /home/dsetl01/my_prg/tmp/output.txt /home/dsetl01/my_prg/tmp/output`date +"%Y%m%d_%H%M%S"`.txt
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 »

well I can create a file at the same path using touch command.

Code: Select all

touch output_2006-07-13_19:28:50.txt
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Can you vi it or cat it.
And the problem is not even due to AIX. Over here i tested it both on Sun and AIX. No problems. Also i checked on wikepedia, the colon is not a forbidden character. So its definately something else.
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 »

opdas wrote:well I can create a file at the same path using touch command.

Code: Select all

touch output_2006-07-13_19:28:50.txt
Then to me it looks like it's coming down to an issue with the ancient version of DataStage you are running. Can you contact Ascential Support and verify?
-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 »

Upgrade. Simple as that.
Try the after job subroutine.
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 »

Hi
Can you pl check at the server if its creating a file name with current date-time when you use
output`date +"%Y%m%d_%H%M%S"`.txt
i.e it creates a file name as "output20060713_201435.txt"

or its just creating a file with name :

output`date +"%Y%m%d_%H%M%S"`.txt
Om Prakash


"There are things that are known, and there are things that are unknown, and in between there are doors"
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

I did. I tested it out.
It creates the file "output20060713_201435.txt"
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 »

There is something seriously wrong .... i need to do an investigation. :roll:
Om Prakash


"There are things that are known, and there are things that are unknown, and in between there are doors"
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Try checking with your unix admin.
Try running this command at the unix level, just copy past my code and see if the file gets created.

Code: Select all

touch output`date +"%Y%m%d_%H%M%S"`.txt 
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
sravanthi
Participant
Posts: 83
Joined: Fri Jun 02, 2006 5:37 am

file_timestamp

Post by sravanthi »

chulett wrote::!: 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? :?
================================
Hi ,

I want to generate a file with timestamp in this format name_YYMMDDddmmss.xml.

For this prsently i'm using unix script.is there any way to generate from datastage itself.When i use name_#DSJobStartTimestamp#.it is generating as name_2006-07-25 01:09:24.xml.I need name_060725010924.xml.

is there any way for doing this.

thanks!
sravanthi
Post Reply