DSD.SEQOpen Unable to create file
Moderators: chulett, rschirm, roy
DSD.SEQOpen Unable to create file
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
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
Thanks,
Madhavi
Madhavi
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.
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
... 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
You may also be able to engineer the renaming to occur during the actual copying of the file.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
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.
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.
Thanks,
Madhavi
Madhavi
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
IHTH
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
No idea what this means.pmadhavi wrote:But I am not able to view the Routine stage output in the Execute command stage.
![Confused :?](./images/smilies/icon_confused.gif)
Code: Select all
#YourRoutineStageName.$ReturnValue#
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
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.
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.
Thanks,
Madhavi
Madhavi
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.
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.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers