From:	CSBVAX::MRGATE!@KL.SRI.Com:info-vax-request@kl.sri.com@SMTP  1-JUL-1987 11:51
To:	EVERHART
Subj:	shar (sort of) for VMS Version 3.06

Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Tue 30 Jun 87 13:47:21-PDT
Received: by ucbvax.Berkeley.EDU (5.58/1.26)
	id AA03514; Tue, 30 Jun 87 10:43:16 PDT
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 30 Jun 87 07:34:07 GMT
From: uunet!munnari!murdu!u3369429@seismo.css.gov  (Michael Bednarek)
Organization: I.A.E.S.R., Melbourne University
Subject: shar (sort of) for VMS Version 3.06
Message-Id: <1270@murdu.OZ>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Hi netlanders!
 
Three weeks ago, I published my VMS_SHAR procedure.

This prompted a lot of useful reactions from you. So I went back to the
drawing board and re-wrote it. Not all suggestions have been implemented, yet.

Blurb and history are included in the procedure itself.
 
Michael Bednarek u3369429@{murdu.oz.au | xvax.dn.mu.oz.au}    "POST NO BILLS."
 
........................ Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-3.06 30-Jun-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by U3369429 (Michael Bednarek)
$!      on Tuesday 30-JUN-1987 17:19:59.44
$!
$! It contains the following 1 file:
$! VMS_SHAR.COM
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$!See what VMS version we have here:
$ Version=F$GetSYI("VERSION")
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
		", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ EDIT/EDT/NoJournal/Output='File_is' VMS_SHAR_DUMMY.DUMMY
Set Quiet; Change; 32000(D+C L)
Exit
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="VMS_SHAR.COM"
$ Check_Sum_is=992556736
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$ Verify='F$Verify(0)
X$ Facility_Name=	"VMS_SHAR"
X$ Facility_Version=	"V-3.06 30-Jun-1987"
X$!
X$ SS$_Abort=44
X$ On Control_Y then goto Abort
X$ On Error then Continue
X$!
X$!Michael Bednarek		u3369429@{murdu.oz.au | ucsvc.dn.mu.oz.au}
X$!Institute of Applied Economic	-- or --
X$!  and Social Research (IAESR)	...seismo.CSS.GOV!munnari!
X$!Melbourne University		   {murdu.oz | ucsvc.dn.mu.oz}!u3369429
X$!Parkville 3052, Phone : +61 3 344 5744
X$!AUSTRALIA
X$!
X$! Copyright (c) 1987, by Michael Bednarek
X$! The distribution of this file is unrestricted as long as this notice
X$! remains intact.
X$!
X$! Usage: @VMS_SHAR file[,file...]  sharfile
X$! where file     are file names, separated by commas, possibly including
X$!		  wild-card characters, of those files that are to be packaged.
X$!	 sharfile is the resulting self-unpacking archive file.
X$! VAX/VMS version 4.4 or higher
X$!
X$ Goto Start
X$Abort:
X$ Close/Error=Anyway Out
X$Anyway:
X$ Exit SS$_Abort
X
XREAD_ME:
X
XFeatures:
X o Through the use of SET SYMBOL/SCOPE=(NOLOCAL,NOGLOBAL) both VMS_SHAR
X   and the procedures created by it are very rubust against local
X   idiosyncrasies with symbols. Imagine a user who does: IF=="!" !
X o The resulting file gives the username of its creator and date/time
X   of creation. If the global symbol REAL_NAME exists, its content is
X   also displayed.
X o The resulting file contains a list of all its files.
X o At creation time, each line is preceded by character 'X' which is
X   removed at unpacking time. This is to preserve leading tabs/spaces
X   through various mailers.
X o Some mailers disallow postings above a certain size. VMS_SHAR will check
X   that the resulting file will not exceed MAX_PART_SIZE which is currently
X   set to 31 blocks (our mailer disallows postings >16000 characters).
X   If more than 31 blocks are to be rk if in the course of packaging the files it
X$! turns out that by adding all those "X"s an archive suddenly needs more than
X$! one part. The probability for this is rather low, though, because the
X$! combined files are on average 256*(Number of files) bytes shorter than
X$! their individual block numbers added.
X$ Part_Name=F$FAO("!#ZL",i,F$Integer(Part_Name)+1)
X$ If Size'n.le.MAX_PART_SIZE then goto Fits
X$ Say ""
X$ Say "The file ",File'n
X$ Say "is ",F$Integer(Size'n-MAX_PART_SIZE),-
X	" blocks larger than MAX_PART_SIZE.",BEL
X$ Say "You will have to carve up that file manually."
X$ Say "I'll attempt to increment the part number appropriately"
X$ Current_Part=F$Integer(Part_Name)
X$ Part_Name=F$FAO("!#ZL",i,F$Integer(Size'n/MAX_PART_SIZE)+Current_Part)
X$ Current_Part=F$FAO("!#ZL",i,Current_Part)
X$ Say "The file ",Shar_File,Part_Name,Of_Name," should be split into",BEL
X$ Say Shar_File,Current_Part,Of_Name," to ",Shar_File,Part_Name,Of_Name
X$ Say "NOTE: the common suffix ",Of_Name," is now also wrong."
X$ Say "I'm afraid you have to rename all files manually."
X$ Read/End_of_File=Fits/Prompt="Enter <RETURN> to continue " SYS$Command ddd
X$Fits:
X$ Write Out "$ Goto Part''Part_name'"
X$ Close Out
X$ Say ""
X$ Say "Now writing to ",Shar_File,Part_Name,Of_Name
X$ Copy NL: 'Shar_File''Part_Name''Of_Name
X$ Open/Append Out 'Shar_File''Part_Name''Of_Name
X$ Write Out "$Part''Part_Name':"
X$Same_Part1:
X$ Say "appending ",File'n
X$ If F$TRNLNM("Out").eqs."" then Open/Append Out 'Shar_File''Part_Name''Of_Name
X$ Write Out "$ File_is=""''Name'"""
X$ Checksum &File'n
X$ Write Out "$ Check_Sum_is=''CHECKSUM$CHECKSUM'"
X$ Write Out "$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY"
X$ Close Out
X$ Define/User_Mode SYS$Output NL:
X$ EDIT/EDT/NoJournal/Output=VMS_SHAR_DUMMY.DUMMY &File'n
XSet Quiet; Change; ER -L 32000(88ASC -2L)
XExit
X$ Append VMS_SHAR_DUMMY.DUMMY 'Shar_File''Part_Name''Of_Name
X$ Delete VMS_SHAR_DUMMY.DUMMY;*
X$ Append SYS$Input 'Shar_File''Part_Name''Of_Name
X$ Deck/Dollars="Just_1"
X$ GoSub Convert_File
XJust_1
X$ If n.lt.nF then goto Extract_Next
X$ Append SYS$Input 'Shar_File''Part_Name''Of_Name
X$ Deck/Dollars="The End"
X$ Exit
XThe End
X$ Say F$FAO("SHAR-file ''Shar_File' was written in !SL part!%S",-
X	F$Integer(nParts))
X$ Directory/Size=Used/Date=Created 'Shar_File'*
X$ Verify=F$Verify(Verify)
$ GoSub Convert_File
$ Exit
