Buffering records

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline displays the contents of file: example.txt, translated to uppercase, followed
.* by the lowercase translation of the file. The BUFFER stage prevents the pipeline from stalling.
 
pipe (endchar ? comment //)
     < &installdrive:\&installpath\Examples\Input\example.txt // Read input file.
     | strip trailing                 // Trim off whitespace.
     | a: locate                      // Route out null records.
     | d: faninany                    // Read from both pipelines.
     | b: fanout                      // Copy input to primary and secondary output streams.
     | xlate upper                    // Translate to uppercase.
     | c: fanin                       // Combine streams into single stream.
     | console                        // Display records on the console.
     ?
     a:                               // Start of second pipeline.
     | specs x20 1                    // Replace a null record with a space.
     | d:                             // Define secondary input for FANINANY.
     ?
     b:                               // Define secondary output stream for FANOUT.
     | xlate lower                    // Translate to lowercase.
     | buffer                         // Buffer to prevent pipeline from stalling.
     | literal                        // Write a blank record.
     | c:                             // Define secondary input stream for FANIN.