Hi All,
I have a parallel job, which picks a flat file from a specified folder. I want the job to terminate if the file is missing with a required information. And also to rename the file.
Can this be done, if yes, can any one please suggest how to accomplish this.
Thank you
Arun
Renaming a file...
Moderators: chulett, rschirm, roy
Renaming a file...
Arun Gautam
Business Objects, Cognos and Datastage
India
Business Objects, Cognos and Datastage
India
-
- Participant
- Posts: 58
- Joined: Tue Nov 17, 2009 3:38 am
Hi Arun,
In sequential file stage there is a property "Missing File Mode".You have to set this property value to "ERROR".
After setting this property,if a specified file does not exist,the job will abort.
To rename a file,you may try following:
a) In Execute command activity of a sequence,you can run the command
mv old_name new_name
b) In the parallel job you can use a before job routine.Inside the routines the command mv old_name new_name can be executed using DSExecute().
In sequential file stage there is a property "Missing File Mode".You have to set this property value to "ERROR".
After setting this property,if a specified file does not exist,the job will abort.
To rename a file,you may try following:
a) In Execute command activity of a sequence,you can run the command
mv old_name new_name
b) In the parallel job you can use a before job routine.Inside the routines the command mv old_name new_name can be executed using DSExecute().
Nikhil
Thank you for the reply Nikhil.
I think I did not convey my problem correctly, let me rephrase the problem statement.
I have a flat file, lets it has about 400 columns (comma delimited) and a million rows. And out of those 400 columns about 20 columns are mandatory. If any of these 20 columns have a NULL or does not contain a value, the job should be terminated and the flat file should be renamed. If the flat file name was FF1.txt then it should be renamed to FF1_Err.txt.
Thanks
Arun
I think I did not convey my problem correctly, let me rephrase the problem statement.
I have a flat file, lets it has about 400 columns (comma delimited) and a million rows. And out of those 400 columns about 20 columns are mandatory. If any of these 20 columns have a NULL or does not contain a value, the job should be terminated and the flat file should be renamed. If the flat file name was FF1.txt then it should be renamed to FF1_Err.txt.
Thanks
Arun
Arun Gautam
Business Objects, Cognos and Datastage
India
Business Objects, Cognos and Datastage
India
-
- Participant
- Posts: 58
- Joined: Tue Nov 17, 2009 3:38 am
Arun,
This can be used using two transformer stages.
From the first transformer stage take two output link say Err_out and Clean_Out
For the link Err_Out,put the conditions in the constraints for checking null values. e.g. ISNULL(Link_Name.Column_Name) or ISNULL(Link_Name.Column_Name)
The output Err_Out should go to the second transformer.In the second transformer there is property "Abort After rows" in constraints.Set its value to 1.
Flow :
Seq_File_Stage--->Transformer1-----Err_Out--->Transformer2
Here,when any column is null the record will go to the second transformer.The second transformer will abort the job.
=============
Renaming the file :
The parallel job will be called from a sequence.In the sequence you can set the flow to "Execute Command activity"(Using Trigger of job activity).
In the execute command activity the file can be renamed by using
mv old_name new_name
=================
If the file name is dynamic,you can capture the file name using Field function in user variable activity.
Example :
Field("FF1.txt ", "." ,1):"_Err.txt"
The above function will pick FF1 from FF1.txt .Then it will append "_Err.txt" to FF1.Hence the name would be "FF1_Err.txt".This can be assigned to a variable and user variable activity and passed to Execute command activity.
This can be used using two transformer stages.
From the first transformer stage take two output link say Err_out and Clean_Out
For the link Err_Out,put the conditions in the constraints for checking null values. e.g. ISNULL(Link_Name.Column_Name) or ISNULL(Link_Name.Column_Name)
The output Err_Out should go to the second transformer.In the second transformer there is property "Abort After rows" in constraints.Set its value to 1.
Flow :
Seq_File_Stage--->Transformer1-----Err_Out--->Transformer2
Here,when any column is null the record will go to the second transformer.The second transformer will abort the job.
=============
Renaming the file :
The parallel job will be called from a sequence.In the sequence you can set the flow to "Execute Command activity"(Using Trigger of job activity).
In the execute command activity the file can be renamed by using
mv old_name new_name
=================
If the file name is dynamic,you can capture the file name using Field function in user variable activity.
Example :
Field("FF1.txt ", "." ,1):"_Err.txt"
The above function will pick FF1 from FF1.txt .Then it will append "_Err.txt" to FF1.Hence the name would be "FF1_Err.txt".This can be assigned to a variable and user variable activity and passed to Execute command activity.
Nikhil
In my mind, the biggest question re: failing the job is - do you want to fail it when the first issue is found or after all issues are found and logged? Also, the rename can be done "after job" by checking the INTERIMSTATUS to see if the job is on its way to Abortsville.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers