Hi All,
I asked this Question a week ago and I got a partial solution.
My ETL job creates a external table as Emp.txt in Netezza server. The requirement is this Emp.txt should be named like Emp022707.txt(it should have current date appended to it). Earlier I got a solution from this forum where in I tried with
cp Emp.txt Emp`date +%m%d%y`.txt
using this logic, I am able to copy the file with new name as 'Emp022707.txt?'....I am not sure why that question mark is coming along. Moreover I am not able to access that new file. Can anyone help me to write a script which can be called from ETL job which does the renaming? I am getting the same problem with 'mv' command too.
Thanks in Adance
Renaming a File with Current Date
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 21
- Joined: Fri Feb 16, 2007 12:09 pm
-
- Participant
- Posts: 21
- Joined: Fri Feb 16, 2007 12:09 pm
-
- Participant
- Posts: 21
- Joined: Fri Feb 16, 2007 12:09 pm
hi yashwin,
Why are you creating the file and then trying to rename it?
If you cannot change the existing file name, then that's fine but you can parameterize the filename in the DataStage job.
Add a new parameter CycleDate to your list of parameters and in the datastage job the filename can be coded as Emp#CycleDate#.txt.
Why are you creating the file and then trying to rename it?
If you cannot change the existing file name, then that's fine but you can parameterize the filename in the DataStage job.
Add a new parameter CycleDate to your list of parameters and in the datastage job the filename can be coded as Emp#CycleDate#.txt.
Aparna
-
- Participant
- Posts: 21
- Joined: Fri Feb 16, 2007 12:09 pm
Aparna,
Thanks for your reply but let me be very clear this time.
See,
My Datastage job has a target which creates an external table. For your ref:
create external table DB..Emp SAMEAS DB..Emp_v USING (DATAOBJECT ('/nz/hrms/data/target/Emp.txt') COMPRESS FALSE FORMAT 'text' DELIMITER '|' );
Now this statement creates an file Emp.txt in Netezza server '/nz/hrms/data/target/'.
Now the user's requirement is that they want the file in Netezza server rather than datastage server. That is the reason I used external table.
Now, the format of the file should be EmpMMDDYY.txt The file should pick up the date of every sunday(job is scheduled on sunday)
So, only alternative left for me is to use shell scripts to rename the file..
cp Emp.txt Emp`date +%m%d%y`.txt works fine when used directly but includes a '?' mark when included in a shell script.
I hope its clear.
Thanks
Thanks for your reply but let me be very clear this time.
See,
My Datastage job has a target which creates an external table. For your ref:
create external table DB..Emp SAMEAS DB..Emp_v USING (DATAOBJECT ('/nz/hrms/data/target/Emp.txt') COMPRESS FALSE FORMAT 'text' DELIMITER '|' );
Now this statement creates an file Emp.txt in Netezza server '/nz/hrms/data/target/'.
Now the user's requirement is that they want the file in Netezza server rather than datastage server. That is the reason I used external table.
Now, the format of the file should be EmpMMDDYY.txt The file should pick up the date of every sunday(job is scheduled on sunday)
So, only alternative left for me is to use shell scripts to rename the file..
cp Emp.txt Emp`date +%m%d%y`.txt works fine when used directly but includes a '?' mark when included in a shell script.
I hope its clear.
Thanks
Sachin