Appending records to a file
This simple recipe shows how a file can be built in within different sub jobs by appending data to an existing file. The append method is one way of building complex files, as will be demonstrated in later recipes in this chapter.
Getting ready
Open the jo_cook_ch08_0010_fileAppend
job.
How to do it...
The steps for appending records to a file are as follows:
Copy the complete
subjob1 – copy me
sub job and paste it to create a second sub job.Link the two sub jobs using an
onSubjobOK
link.Open
tFixedFlowInput
, and changeRecords from first subjob
toRecords from second subjob
.Open
tFileOutputDelimited
on the new sub job, and tick Append, as shown in the following screenshot:
How it works...
The first sub job creates the file, and the second sub job appends to the same file.
There's more…
While relatively trivial, this recipe demonstrates a very powerful method for creating files that do not adhere to the norm, such as files containing a mixture of fixed and delimited data...