Since it's Friday (it was when I started) forgive me the long post.

The trick is that 'predselect' holds each record from the primary input
and looks at the other two inputs to decide where to write the record.

The second copy of each set produced by 'fanout' is restored into lines
and we then hunt for bad signs (i.e. an OFFLINE device or one that has
any '-' signs in the (LPM) line). Any such bad sign goes the tertiary
input of 'predselect' to have it defer the set.

Happy Plumbing,
Sir Rob the Plumber


/* QP       EXEC          Remove the good ones from QUERY PATHS      */
/*                        Author: Rob van der Heij, 24 Mar 2017      */

arg devices  .
parse value devices '0-FFFF' with devices .

address command
'PIPE (end \ name QP.EXEC:8)',
   '\ var devices ',
   '| spec ,QUERY PATHS, 1 1-* nw ',
   '| cp',
   '| pick 24+ /== ,Legend,',         /* Drop trailing record        */
   ,
   '| insert ,;, after',              /* Group sets of records       */
   '| joincont leading , , keep',
   '| o: fanout ',
   '| p: predselect',
   '| count lines',
   '| spec ,There are, 1 w1 nw ,devices just fine, nw',
   '| cons',
   '\ o: ',
   '| deblock linend ;',
   '| z: pick 21+ /== ,OFFLINE,',     /* That's a bad one            */
   '| pick w2 == ,(LPM),',            /* The online chpids           */
   '| y: nlocate fs : f2 /-/',        /* Any offline chpids here?    */
   '| p:',
   '| deblock linend ;',
   '| insert ,Bad , before',
   '| cons',
   '\ z:',                            /* Device offline              */
   '| i: faninany',
   '| p:',
   '\ y:',                            /* One or more paths offline   */
   '| i:'

return rc

Reply via email to