Waiting for file to finish and append

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

Waiting for file to finish and append

Post 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
Krazykoolrohit
Charter Member
Charter Member
Posts: 560
Joined: Wed Jul 13, 2005 5:36 am
Location: Ohio

Post by Krazykoolrohit »

do the file appends in next job.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Write to a different file the second time and then use a link collector to collect the two files.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
rodre
Premium Member
Premium Member
Posts: 218
Joined: Wed Mar 01, 2006 1:28 pm
Location: Tennessee

Post by rodre »

Thanks for the help, this should work!!!
Shree0410
Participant
Posts: 70
Joined: Tue Nov 29, 2005 7:25 pm

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

Post 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.
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