Page 1 of 1

Waiting for file to finish and append

Posted: Tue Jul 18, 2006 12:49 pm
by rodre
I have a Server job that writes rejections on a sequential file. In the next transformer there are more rejections which writes to a temp and ultimately should be appended to the first rejections file.
The problem is: It aborts because it is trying to write to a file that is open. I tried using the DSWaitForFile in the Before or After-stage, however it does not recognize if the rejections file is already there to begin with, so it hangs waiting until it fails.
I searched the Archives and tried different other things but I keep getting the job to Abort when trying to append back in the first file. The first file seemed finished or looks finished.
Any suggestions how to do this?
Is there a better way to do this?

Here is how my job looks like:

Code: Select all

Seq. file- - - > Transf- - - - - - - - - >Transf- - - - >Output file
                   |                        |
                   |                        |
                   v                        v
              Reject file       Temp Reject File
                                            |
                                            |
                                            v
                                        Transf       
                                            |
                                            |
                                            v
                                 Append to Reject file
Thanks,
Rodre

Posted: Tue Jul 18, 2006 12:55 pm
by Krazykoolrohit
do the file appends in next job.

Posted: Tue Jul 18, 2006 12:56 pm
by DSguru2B
Write to a different file the second time and then use a link collector to collect the two files.

Posted: Tue Jul 18, 2006 1:33 pm
by rodre
Thanks for the help, this should work!!!

Posted: Tue Jul 18, 2006 2:29 pm
by Shree0410
Write the rejections to 2 different file and 'cat' these 2 files to one file in the After job routine.

Using the link collector may grow the size of the job template/canvas

Posted: Tue Jul 18, 2006 6:34 pm
by ray.wurlod
Do the append in an after-job subroutine. Call ExecDOS and execute the command type file2 >> file1. By the time an after-job subroutine is executed, all output links (and the files to which they refer) have been closed.