Empty Source

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
tjmeichen
Participant
Posts: 14
Joined: Wed Aug 14, 2002 7:43 am
Location: USA

Empty Source

Post by tjmeichen »

I have a situation where I will not be getting any data from my source, but I still need to populate a file with some hard coded data and a record count coming from the source. The source gives me no records, so it cannot populate the count and I get no output.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Probably several different ways to accomplish this. What we typically end up doing is breaking jobs up into a series of jobs or phases. We might write out an empty control record in an initial job that does whatever other 'prep' work is needed, have intermediate job(s) that actually process the data file(s), and then a final job that updates the control record with what actually happened. In this case the controlling batch may check row counts going down links and can then log them and pass them as parameters to the final job, or the job could pull counts from the target table. You can also use hash files between jobs to 'pass' information. You can sometimes condense this down into a single job using before- and after-job routines... really depends on exactly what you want to do.

Hope this helps,

-craig
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

One of the easiest things to do, if the output is a sequential file, is to create an after-stage routine that obtains the link row count then uses the operating system command echo to append the desired "trailer" record.
Similarly, one or more echo commands in a before-stage routine could create a "header" record.

It's not all that difficult to extend this to hashed files, UV tables or ODBC tables.
Post Reply