page_title: Flow-based programming
section_title: Batch update
hierarchical_section_title: Flow-based programming / Examples / Batch update
caption_attribution_description: English: Canonical "batch update" structure
context_page_description: In computer programming, flow-based programming is a programming paradigm that defines applications as networks of "black box" processes, which exchange data across predefined connections by message passing, where the connections are specified externally to the processes. These black box processes can be reconnected endlessly to form different applications without having to be changed internally. FBP is thus naturally component-oriented.
  FBP is a particular form of dataflow programming based on bounded buffers, information packets with defined lifetimes, named ports, and separate definition of connections.
context_section_description: This type of program involves passing a file of "details" (changes, adds and deletes) against a "master file", and producing (at least) an updated master file, and one or more reports. Update programs are generally quite hard to code using synchronous, procedural code, as two (sometimes more) input streams have to be kept synchronized, even though there may be masters without corresponding details, or vice versa.
  In FBP, a reusable component (Collate), based on the unit record idea of a Collator, makes writing this type of application much easier as Collate merges the two streams and inserts bracket IPs to indicate grouping levels, significantly simplifying the downstream logic.  Suppose that one stream ("masters" in this case) consists of IPs with key values of 1, 2 and 3, and the second stream IPs ("details") have key values of 11, 12, 21, 31, 32, 33 and 41, where the first digit corresponds to the master key values.  Using bracket characters to represent "bracket" IPs, the collated output stream will be as follows:
  ( m1 d11 d12 ) ( m2 d21 ) ( m3 d31 d32 d33 ) (d41)
  As there was no master with a value of 4, the last group consists of a single detail (plus brackets).
  The structure of the above stream can be described succinctly using a BNF-like notation such as
  { ( [m] d* ) }*
  Collate is a reusable black box which only needs to know where the control fields are in its incoming IPs (even this is not strictly necessary as transformer processes can be inserted upstream to place the control fields in standard locations), and can in fact be generalized to any number of input streams, and any depth of bracket nesting.  Collate uses an array-type port for input, allowing a variable number of input streams.
caption: Canonical "batch update" structure
exif: {}