Page 1 of 1

DSD.SEQOpen Unable to create file

Posted: Mon Aug 07, 2006 3:56 pm
by pmadhavi
Hi
I have to generate a flat with with the timestamp in the name of the file.
I gave Test_#DSJobStartTimestamp#.txt; it throws an error
DSD.SEQOpen Unable to create file

I gave Test_#DSJobStartTime#.txt; it throws an error.

DSD.SEQOpen Unable to create file D:\TestFolder\Test16:38:43.csv.

If I give Test_#DSJobStartDate#, it is working fine.

But I need to have the file with timestamp because the job may run more than once in a day.

Is it because there is a colon in the timestamp?
Somebody in one of the postings suggested to replace the ':' with '-'.
But we have to do it before we cretae the file.

Can we give the calculated column name as part of the file name?

Did anybody come across such situation? pls help me out.

Thank you

Posted: Mon Aug 07, 2006 4:07 pm
by chulett
The colon isn't valid in a Windows filename, it's part of a drive designator.

As noted many many times here, rather than fight this before or during the job, best to create a static filename and then rename it 'after job' to suit your needs. A standardized UNIX script or DOS batch file could do the trick.

Posted: Mon Aug 07, 2006 10:33 pm
by ray.wurlod
... but you still won't be able to use ":" in a Windows pathname except immediately following the drive letter. In short, you can not break the rules of the operating system.

Posted: Tue Aug 08, 2006 8:35 am
by pmadhavi
my requirement is to copy a file to a share drive for business users.

I need to make the file unique so that next time when i run the job it should not get overwritten.

Do we have any other way of achieving this?
pls throw some light on this.

Posted: Tue Aug 08, 2006 8:56 am
by chulett
Go with your original idea - just don't try to put colons in the filename. As noted, best to create the file with a fixed name and then write a BAT file to rename the file 'after job' to include the current date/time or whatever else you'd like to include to make it unique...

You may also be able to engineer the renaming to occur during the actual copying of the file.

Posted: Tue Aug 08, 2006 12:11 pm
by pmadhavi
I created a routine with the code given below(to remove : and spaces from the Timedate())

FileName = Arg1
Addtag=ereplace(ereplace(ereplace(TimeDate(),':',''),' ','_',1),' ','')

NewFileName = FileName:"_":Addtag:".txt"
Ans=NewFileName
-------------------------------------------------------

I have a job sequence wherein I am calling the server job first(where the actual flat file gets created)
next I am calling the routine mentioned above to cretae a new file name with timestamp details in it.
then I have Execute Command Stage where I am calling a batch file which copies the file to the shared drive. In the batch file the target file name would be the output of the routine stage.

But I am not able to view the Routine stage output in the Execute command stage.

Please suggest me how to pass the target filename from Routine stage to Execute command stage.

Posted: Tue Aug 08, 2006 12:21 pm
by kris007
I am not sure how you are passing the filename to the Routine Activity stage in the JobSequence. But here's suggestion which might or might not meet your requirements. Use a UserVariable activity and create one parameter. In the expression editior call the Renaming routine you have created and pass the filename to that routine. Then pass this to the Execute Command Activity stage and you should be set. If not, another method I can think of would be looking at the defining a Custom trigger coming out from your Routine Activity Stage.

IHTH

Posted: Tue Aug 08, 2006 12:32 pm
by chulett
pmadhavi wrote:But I am not able to view the Routine stage output in the Execute command stage.
No idea what this means. :? Nothing should be stopping you from using the output of the routine in the Execute Command stage just like you could in any downstream stage.

Code: Select all

#YourRoutineStageName.$ReturnValue#
That would equate to the filename it builds.

Posted: Tue Aug 08, 2006 12:43 pm
by pmadhavi
Thanks for a quick reply.

Sorry for not mentioning the version I am using. It is DS7.1r1 where most of the features are not there. Not even the User variable stage u mentioned.

The thing is the file name which is getting created when we run the job, is static. So I hardcoded the job name in the parameter section of the Routine activity to get a new file name. Till that step it is working fine.

any suggestions are welcome.

Posted: Tue Aug 08, 2006 12:54 pm
by chulett
Ok, in that case you need to replace the Execute Command stage with another Routine Activity stage. You'll also need to write a generic routine that runs an operating system command using DSExecute. In that routine you can ensure that all of the parameter arguments get evaluated properly.

Or a specific routine that just runs the script in question, passing in whatever you need as arguments to the routine... including this new filename.