From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-APR-1989 22:10
To:	MRGATE::"ARISIA::EVERHART"
Subj:	PIPE.1_of_4

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 24 APR 89 18:12:09 PDT
Received: from relay.ubc.ca by KL.SRI.COM with TCP; Mon, 24 Apr 89 17:54:50 PDT
Received: by relay.ubc.ca (5.59/1.14)
	id AA03164; Mon, 24 Apr 89 17:53:45 PDT
Date: 24 Apr 89 18:53 -0600
From: Ken Wallewein <kenw%noah.arc.cdn@relay.ubc.ca>
To: <info-vax@kl.sri.com>
Message-Id: <2857*kenw@noah.arc.cdn>
Subject: PIPE.1_of_4

$! ................... Cut between dotted lines and save. ...................
$!...........................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.10 7-FEB-1989.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user KENW
$! on  7-APR-1989 22:51:31.37.
$!
$! ATTENTION: To keep each article below 26 blocks (13312 bytes), this
$!            program has been transmitted in 4 parts.  You should
$!            concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 32 files:
$!        AAAREADME.TXT
$!        AAASYNOPSIS.TXT
$!        ALLDUPS.COM
$!        COMBINE.COM
$!        COUNT.COM
$!        DCL.COM
$!        DUPS.BAS
$!        DUPS.COM
$!        ECHO.COM
$!        EDIT.COM
$!        ELEMENT.COM
$!        EXTRACT.COM
$!        FIL2DIR.COM
$!        ITEM.COM
$!        LOCAL_COPIES.COM
$!        LOCAL_COPIES.DAT
$!        NOCTRL.C
$!        NODUPS.COM
$!        PIPE.COM
$!        PIPE.HLP
$!        PIPE_LOGIN.COM
$!        PURGABLE.COM
$!        SKIP.COM
$!        STEM.BAS
$!        STEM.C
$!        STEM.COM
$!        STEMS.C
$!        SUBSTITUTE.COM
$!        TEE.COM
$!        TIME.COM
$!        TOTAL.COM
$!        WIDE.BAS
$!
$!============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.10 7-FEB-1989 requires VMS V4.4 or higher."
$ EXIT 44 ! SS$_ABORT
$VERSION_OK:
$ GOTO START
$!
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY
b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) )
; s_file_spec := GET_INFO( COMMAND_LINE, "output_file" ); SET( OUTPUT_FILE
, b_part, s_file_spec ); b_errors := CREATE_BUFFER( "{Errors}" ); i_errors 
:= 0; pat_beg_1 := ANCHOR & "-+-+-+ Beginning"; pat_beg_2 := LINE_BEGIN 
& "+-+-+-+ Beginning"; pat_end := ANCHOR & "+-+-+-+-+ End"; POSITION
( BEGINNING_OF( b_part ) ); LOOP EXITIF SEARCH( SPAN( ' ' )@r_trail 
& LINE_END, FORWARD) = 0; POSITION( r_trail ); ERASE( r_trail ); ENDLOOP
; POSITION( BEGINNING_OF( b_part ) ); i_append_line := 0; LOOP EXITIF MARK
( NONE ) = END_OF( b_part ); s_x := ERASE_CHARACTER( 1 )
; IF s_x = '+' THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip 
<> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF
; ENDIF; IF s_x = '-' THEN r_skip := SEARCH( pat_end, FORWARD, EXACT )
; IF r_skip <> 0 THEN s_x := ''; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip 
:= MARK( NONE ); r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip 
<> 0 THEN POSITION( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET )
; MOVE_VERTICAL( 1 ); MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part 
) ); ENDIF; ERASE( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF
; IF s_x = 'V' THEN s_x := ''; IF i_append_line <> 0 THEN APPEND_LINE
; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF; i_append_line := 1
; MOVE_VERTICAL( 1 ); ENDIF; IF s_x = 'X' THEN s_x := ''; IF i_append_line 
<> 0 THEN APPEND_LINE; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ENDIF
; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; IF s_x <> '' THEN i_errors 
:= i_errors + 1; s_text := CURRENT_LINE; POSITION( b_errors ); COPY_TEXT
( "The following line could not be unpacked properly:" ); SPLIT_LINE
; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part ); MOVE_VERTICAL
( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP r_x := SEARCH
( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x ); ERASE_CHARACTER
( 1 ); COPY_TEXT( ASCII( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDLOOP
; IF i_errors = 0 THEN SET( NO_WRITE, b_errors, ON ); ELSE POSITION
( BEGINNING_OF( b_errors ) ); COPY_TEXT( FAO
( "The following !UL errors were detected while unpacking !AS", i_errors
, s_file_spec ) ); SPLIT_LINE; SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" )
; ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!!,passed." )
$ RETURN
$!
$START: 
$ FILE_IS = "AAAREADME.TXT"
$ CHECKSUM_IS = 106769723
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XContents
X========
X
XThe PIPE collection includes:
X
XPIPE    Allows combining DCL commands to operate data, eg:
X`009    $ pipe SHOW LOGICAL * `124grep TT,TX `124sort >lp:
X`009    $! shows only logicals pointing directly to TT and TX devices
X`009without worrying about temporary intermediate files.
X
X`009PIPE provides wildcard filespecs for any command, eg:
X`009    $ pipe dir *.FOR `124 ?edit`032
X`009edits every .FOR file.  The '?' switches the mode to 'execute with`032
X`009data as args' from the default 'execute with data as input', and
X`009asks you first.
X
X`009PIPE allows multiple commands to be executed sequentially, as in:
X`009    $ pipe show users > OPA0: ;sho sys >OPA0:
X
X`009PIPE allows redirection of output for programs which don't normally`032
X`009allow this, eg:`032
X`009    $ pipe auth sho brief * >lp:
X
X`009PIPE allows more selective outputs from programs, eg:
X`009    $ p show system `124grep acp,symb
X`009    $! show only ACPs and SYMBIONTs
X
X`009PIPE allows easy execution of commands on a predefined set of data,
X`009avoiding custom write read/write loops, eg:
X`009    $ PIPE <LOCAL_COPIES.DAT @LOCAL_COPIES
X
XMisc. Filters
X        These are programs designed to work with PIPE.  NOTE: Compiled
X`009programs need no special treatment.  Just compile as appropriate and
X`009link, both without any special options.  Most filters tend to be
X`009written first in DCL, and rewritten for speed if needed.`032
X
XSTEM*.*
X`009Filter templates in DCL, BASIC, and C.  Good string handling makes for
X`009good filters.`032
X
XLOCAL_COPIES
X`009Uses PIPE and COPY to monitor remote files and make local copies if`032
X`009they change, notifying specified users.
X
XSUBSTITUTE
X        Uses PIPE and EDT to do simple search/substutite on many files
X        from a command line
X
XPURGABLE
X        Displays purgable files in any directory/filespec.  Essentially`032
X`009equivalent to what DIR/EXC=; would do if it worked.  Does _not_ use`032
X`009PIPE.
X
XDocumentation
X `009PIPE.HLP for use with HELP,
X`009AAASYNOPSIS.TXT for tacking to the wall,
X`009and this file.
X
X
X
XInstallation
X============
X
X  Note: It is assumed that you will unpack these files into a directory into
Xwhich you have SET DEFAULT.`032
X
X  Once you have done that, just enter
X
X$ @PIPE_LOGIN.COM
X
Xwhich sets up the PIPE logical and symbol, plus a couple of others which`032
Xare handy but not essential.
X
V  PIPE_LOGIN should be part of the standard login sequence.  Please note that
X,
Xsince it assumes that its location is that of the PIPE package, it must be
Xkept with the other files.`032
X
X  PIPE.HLP should be placed in your choice of .HLB file using`032
X`009$ LIB/HELP library[/CREATE] PIPE.HLP
X
X  Oh, and if you have the appropriate compilers, you'll probably want to
Xcompile and link those filter files that need it.  Personally, I haven't used
Vany of those for a while.  But, like tools, you never know when you'll need`0
X32
Xone.`032
X
X/kenw
X
VKen Wallewein                                                     A L B E R T
X A
Vkenw@noah.arc.cdn                                               R E S E A R C
X H
V(403)297-2660                                                     C O U N C I
X L
X
X"I ain't afraid o' no bugs!"
$ GOSUB UNPACK_FILE

$ FILE_IS = "AAASYNOPSIS.TXT"
$ CHECKSUM_IS = 1598382891
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
V$ P*IPE [ <fromfile] [ +][ ?][command...] [""][args][""] [&line] [ >tofile]`0
X32
X`009[ `124 ...][ ; ...]
X
XCOMBINE
X    Combine groups of sequential lines of input into one output record
X
XCOUNT
X    Counts number of lines/records
X
XDI*RECTORY filespec
X    Single-column filespec-only directory to provide lists of filenames
X
XDUPS start length
V    Finds duplicate entries in the specified portion of the line. Input _must
X_`032
X    be in same sorted order.
X
XECHO
X    Sort of like TEE SYS$COMMAND.
X
XEDIT edit_options
X    Performs a DCL F$EDIT (eg: UPCASE,TRIM) on each line of text
X
XELEMENT element_number [...]
X    Performs a DCL F$ELEMENT(n," ",line) on each line of input, where
X    the first element is 0, and " " represents any combination of spaces
X    and tabs`032
X
XEXTRACT offset length [... ...]
X    Performs a DCL F$EXTRACT(P1,P2,line) on each line of input
X
XFIL2DIR filespec
X    turns filespecs into directory specs
X
XFIND filespec search_spec
V    Finds files containing given search arguments. Returns filespec only, for
X`032
X    further action, eg: pipe find auditer `124 +edit
X
XGREP search_spec
V    Pass only entries containing given text.  Supports all SEARCH options.`03
X2
X    Exactly equivalent to SEARCH SYS$INPUT
X
XITEM _text_ [...]
X    Element following element containing _text_.
X
XLOCAL_COPIES
X    update local copies of files as needed, according to input parameters.
X    Could be modified to be a MAKE.
X
XJUSTIFY (Not currently inplemented)
X    Uses context to align data into columns (eg: for sorting or totaling)
X
XMORE
X    Exactly equivalent quivalent to TYPE/PAGE SYS$INPUT
X
XNOCTRL
X    Filters out control characters.
X
XNODUPS
X     Everything BUT duplicates (see INIQ).  Input _must_ be in same sorted
X     order.`032
X
XPIPE
X    See top line, AAAREADME.TXT, PIPE.HLP
X
XSKIP number_of_lines
X    Skips the first number_of_lines lines (eg: headers) in the input
X
XTEE filespec
X    Writes a copy of the input to the specified file. Defaults to SYS$COMMAND
X
XTOTAL start-column length [... ...(I think)]
X    Total value of all entries in given columns
X
XUNIQ
V    Everything BUT duplicates (See NODUPS). Input _must_ be in same sorted`03
X2
X    order.
X
XWIDE
X    Prints lists in wide format
X
XHandy commands:
X $ gs :== 'pipe show system `124grep`032
X $ e0 :== `124element 0
X $ gs word11 'e0`009! note that the "'" is necessary for inside symbols
X See AAAREADME.TXT for others
$ GOSUB UNPACK_FILE

$ FILE_IS = "ALLDUPS.COM"
$ CHECKSUM_IS = 1210011554
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!alldups.com - pipe command to find all duplicate filenames`032
XPIPE "DIR ALL" `124 "JUST ] 30 . 40" `124 SRT `124 "DUPS 31 13"
$ GOSUB UNPACK_FILE

$ FILE_IS = "COMBINE.COM"
$ CHECKSUM_IS = 2032298764
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!`009combine.COM - combine RMS records for group treatment by GREP, etc
X!
X$`009DEASS SYS$INPUT
X$`009DEASS SYS$OUTPUT
V$`009IF F$LOGICAL("PIPE_INPUT") .NES. "" THEN ASSIGN PIPE_INPUT  SYS$INPUT`03
X2
X$`009IF F$LOGICAL("PIPE_OUTPUT") .NES. "" THEN ASSIGN PIPE_OUTPUT SYS$OUTPUT
X$
X$!`009if p1 .eqs. "" then p1 = 1
X$`009comb = P1
X$`009count= 0
X$
X$`009crlf[0,8]=13
X$`009crlf[8,8]=10
X$
X$`009newrec = ""
X$
X$READ:
X$`009READ/END=DONE SYS$INPUT LINE
X$`009newrec = newrec + line`032
X$`009count = count + 1
X$`009if count .ge. comb then goto write
X$
X$`009newrec = newrec + " " !crlf
X$`009goto read
X$
X$write:
X$`009WRITE SYS$OUTPUT newrec
X$`009newrec=""
X$`009count=0
X$`009GOTO READ
X$
X$DONE:
X$`009if newrec .nes. "" then write sys$output line
X$
$ GOSUB UNPACK_FILE

$ FILE_IS = "COUNT.COM"
$ CHECKSUM_IS = 1847146071
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X!       count.COM - count number of lines in input stream
X!`009`009  - optionally "tee" count
X!
X$       DEASS SYS$INPUT
X$       DEASS SYS$OUTPUT
V$       IF F$LOGICAL("PIPE_INPUT") .NES. "" THEN ASSIGN PIPE_INPUT  SYS$INPUT
X`032
X
V$       IF F$LOGICAL("PIPE_OUTPUT") .NES. "" THEN ASSIGN PIPE_OUTPUT SYS$OUTP
XUT
X$
X$`009count = 0
X$
X$READ:  READ/END=DONE SYS$INPUT LINE
X!
X$`009count = count + 1
X!
X$       if p1 .nes. "" then WRITE SYS$OUTPUT LINE
X$       GOTO READ
X$DONE:
X$`009if p1 .eqs. "" then write sys$output count
X$`009if p1 .nes. "" then write 'p1 count
$ GOSUB UNPACK_FILE

$ FILE_IS = "DCL.COM"
$ CHECKSUM_IS = 220334537
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$!`009DCL  - to a DCL command to the data
X$!
X$`009DEASS SYS$INPUT
X$`009DEASS SYS$OUTPUT
V$`009IF F$LOGICAL("PIPE_INPUT") .NES. "" THEN ASSIGN PIPE_INPUT  SYS$INPUT`03
X2
X$`009IF F$LOGICAL("PIPE_OUTPUT") .NES. "" THEN ASSIGN PIPE_OUTPUT SYS$OUTPUT
-+-+-+-+-+ End of part 1 +-+-+-+-+-

