concatenate of three inut files

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

concatenate of three inut files

Post 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
Last edited by monaz on Tue Nov 09, 2010 4:27 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
monaz
Participant
Posts: 98
Joined: Sat Aug 23, 2008 3:14 am

Post 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...
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply