[comp.os.vms] Using DIFFERENCES to ship edits to files -- here's how:

rlb@rtpark.ge.COM (Bob Boyd 8*565-3627 31-Dec-1987 1330) (01/01/88)

....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-5.01 01-Oct-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 RLB
$! on Thursday 31-DEC-1987 13:29:52.28
$!
$! It contains the following 1 file:
$! PACKAGE.COM
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ 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/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o);
Position(Beginning_of(b));Loop x:=Erase_Character(1);Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;
Move_Horizontal(-Current_Offset);EndLoop;Move_Vertical(1);
ExitIf Mark(None)=End_of(b) EndLoop;Position(Beginning_of(b));Loop
x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1);
If Current_Character='`' then Move_Horizontal(1);else
Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;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="PACKAGE.COM"
$ Check_Sum_is=458833704
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
X$! Procedure to build a kit to send out local edits to any vendor supplied
X$! procedure(s).  This way you only distribute your own contributions to the
X$! procedure(s) -- This is especially useful for things that came in
X$! SYS$EXAMPLES: or SYS$MANAGER:
X$!
X$! Parameters:
X$! p1 -- MASTER/original file
X$! p2 -- site modified version of MASTER file
X$! p3 -- output file for shipment
X$!
X$! Author:`009Robert Boyd, GE Microelectronics Center,
X$! Date:`00917-DEC-1987
X$!
X$! You are free to distribute this as you please with the following
X$! restrictions:
X$!  1.  Any charge must be a reasonable cost for the distribution only; and
X$!  2.  You keep the credits and this notice intact.
X$ set noon
X$!*** change this to point to your copy of VMS_SHAR by Michael Bednarek
X$ vms_shar = "@UTL:VMS_SHAR"
X$ write sys$output "Package up shippable revisions to standard DEC procedure"
X$ inqk = "read sys$command ans"
X$ if p1.eqs."" then $ inqk/prompt="Master/Original file name: "/end=EXIT
X$ if p1.eqs."" then $ p1 = ans
X$ if p2.eqs."" then $ inqk/prompt="Modified/Revised file name: "/end=EXIT
X$ if p2.eqs."" then $ p2 = ans
X$ p2 = f$parse(p2,p1)
X$ if p1.eqs."" .or. p2.eqs."" then $ goto EXIT
X$ p3 = f$parse(p3,".package",p2)
X$ write sys$output "Building ",p3," from MASTER: ",p1,-
X`009", locally revised to: ",p2
X$ tmp_file1 = f$parse(".tmp1",p3)
X$ tmp_file2 = f$parse(".shipable",p3)
X$! build the SUMSLP edit file 
X$ differences 'p1' 'p2'/SLP/output='tmp_file1'-
X`009/ignore=(spacing,trailing_spaces,exact)
X$! build preamble and setup SUMSLP edit
X$ wt = "write tmp_com"
X$ open/write tmp_com 'p3'
X$ wt "$! Procedure to convert ",p1," to ",p2
X$ wt "$! p1 -- output file name"
X$ wt "$!
X$ wt "$! Execute this file with @<file> <target_filename>
X$ wt "$! generated by ",f$getjpi("","username")," at ",f$time()
X$ wt "$!
X$ wt "$ set noon"
X$ wt "$ if p1.eqs."""" then inquire p1 ""Output file name"""
X$ wt "$ write sys$Output ""Updating ",p1," to produce "",p1,"""
X$ wt "$ edit/sum ",p1,"/update=sys$Input:/output='p1'"
X$ wt "$ DECK/dollars=""$*EOD*SUM"""
X$ close tmp_com
X$! put the edit deck together now
X$ append 'tmp_file1' 'p3'
X$ open/append tmp_com 'p3'
X$ wt "$*EOD*SUM"
X$ wt "$ write sys$output ""Completed Conversion"""
X$ close tmp_com
X$! prepare the whole thing for shipment over Internet
X$ vms_shar 'p3' 'tmp_file2'
X$ rename 'tmp_file2' 'p3'
X$! clean house a bit
X$ purge 'p3'/keep=1
X$ delete 'tmp_file1'
X$EXIT:
X$ exit
X$!Last Modified:  17-DEC-1987 11:30:49.31, By: RLB 
$ GoSub Convert_File
$ Exit