If you get the records in chunks, it's really simple to write a sipping
pipeline to take each chunk and write it to a file. You close it when
you're done with the chunk. And you can decide whether you should append or
rewrite the file. That's also helpful when you have some header record
rather than a key in each data record. As John points out, when you're
writing to SFS make sure to say so rather than using a file mode.

The alternative is to use ADDPIPE to create a separate pipeline to write to
a single file; you cascade the selection stages to pick the ones this
pipeline needs to handle. That's attractive when records for different
files are interleaved and you want to rewrite the file, but can't tell in
advance which ones to wipe. I would probably opt for this approach when the
chunks are pretty small and the number of files is not too much.
Another interesting twist is using DISKUPDATE when you can produce the
record number; when dealing with RECFM F files you can even write in
non-consecutive order or create holes in the file.

Sometimes it's easier to just create what you need, rather than figure out
whether someone else wanted just what you need. You normally learn a few
more tricks while doing that, which helps with future plumbing challenges.

Sir Rob the Plumber

Reply via email to