Counting records

Pipelines v1.6

 

.* Example by TenFiftyTwo(c).

Home

 
.* The following pipeline reads all the '.ppl' files in the 'Examples' directory, accumulating the
.* count of the total number of records. As each file is processed the name of the file is written
.* to the console, followed at the end of processing with the count total.
 
pipe (endchar ?)
     filelist noh                                         .* Generate file list. Dont write a header.
              drv=&installdrive                           .* Drive with subsearch option.
              subdir
              path="&installpath\examples"                .* Path to begin searching from.
              ext=ppl                                     .* Extension type.
     | a: fanout                                          .* Write record to both streams.
     | specs w5-* 1                                       .* Discard the file stats.
     | <                                                  .* Read each file.
     | count lines                                        .* Count the records.
     | specs /Total number of records:/ 1 1-* nw          .* Construct output message.
     | cons                                               .* Tell the user.
     ?
     a:
     | specs /Reading file:/ 1 ws '\' w-1 nw              .* Tell user about file currently..
                                                          .* ..being processed.
     | cons                                               .* Tell the user.