Page 1 of 1

concatenate of three inut files

Posted: Tue Nov 09, 2010 1:11 am
by monaz
Hi ,

I have requirement that I need to concate 3 files in the job.

I have written a copy command in after job routine to do the below task.

copy header.txt+detail.txt+trailer.txt Newfile.txt this works out sucessfully .

But I have other requirement when the user sends the empty file and I need t generate only header and trailer .

So I thought of creating a dummy trailer file and execute a batch job to check if the detail.txt is empty then it should pick template_trailer.txt.

Need help on how to write the batch code to do above task.

Please suggest

Posted: Tue Nov 09, 2010 4:05 am
by ray.wurlod
Do you want this solved as a DataStage task or as a "batch code" task?

If the latter, why did you post in a DataStage forum?

Posted: Tue Nov 09, 2010 4:40 am
by monaz
ray.wurlod wrote:Do you want this solved as a DataStage task or as a "batch code" task?

If the latter, why did you post in a DataStage forum? ...
I just thought of Batch code , IF Datastage tool itself can help me to resolve this then it would be good...

Posted: Tue Nov 09, 2010 6:02 am
by ray.wurlod

Code: Select all

if [ -z detail.txt ] then
   copy header.txt+trailer.txt > newfile.txt
else
   copy header.txt+detail.txt+trailer.txt > newfile.txt
fi
Since you are running parallel edition on Windows you have full access to UNIX shell scripting techniques as shown above. I'm sure there is equivalent functionality in DOS shell scripting, but that's not one of my areas of expertise.