From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX"  8-JUN-1992 21:48:56.83
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: HELPLIB.HLB update code for VMS 5.5 pointer needed

Sorry to those who may have received the version of this I sent this afternoon
(now cancelled).  The editor went screwy and only the original message got
posted.  It should have read...
------------------------------------------------------------------------------
In article <1992Jun4.190429.1437@uwovax.uwo.ca>, brent@uwovax.uwo.ca (Brent Sterner) writes:
> 
>    Can anyone point me to the DCL code in the VMS 5.5 release which
> updates the help file?  (I'm not upgrading to VMS 5.5... rather I've
> installed it fresh on a new system.  My old system is VMS 5.4-3.  I'd
> like to upgrade my old help file from the 5.5 distribution, and drop
> it onto my new system.  The alternative will be tedious.)

I attach three command procedure which may prove useful.  We operate a system
of three help files,  only one of which the users have access to (the first).

	HELPLIB.HLB - system help file,  contain VMS information (minus
		      things which the users are no interested in eg.
		      system management utilities and commands we don't
		      want them to know about)

	LOCAL.HLB   - Contains all the non VMS-supplied help info for
		      packages etc.  (Think this is actually called
		      GEOGRAPHY.HLB as we are a Geography Dept.)
		      The users don't see this,  it acts as a bucket for
                      all non-VMS provided help and changes/additions are
                      propagated into HELPLIB.HLB with a command procedure.

	SYSTEM.HLB  - Contains all the bits taken out of HELPLIB.HLB and
		      is attached as a secondary library to system accounts
                      only.

The three procedures are:

	HELPMAN.COM which manages all of this and also gives the functionality
                    to merge libraries and etc.

	RENUMBER.COM which deals with renumbering the topics where it is
                     necessary to change levels when moving package help
                     or system help to another locaiton than where it was
                     originally intended.

	TOPICS_SYS.COM reads a data file (not supplied) to determine what
                     are regarded as "system only" topics and remove these
                     from HELPLIB.HLB and put them in SYSTEM.HLB.  I guess
 		     I could supply the data file if anyone wants it although
		     we haven't gone to VMS 5.5 yet so it might change.

Nothing is particularly sophisticated,  HELPMAN has a nice menu which should
explain what its doing,  the others have a comment or two at the top.  All of
this is fairly hacked together so I don't warrant it will do what you want,
but I find it very useful.   SHARE file after sig.
                                               
Regards,

Bruce.
===============================================================================
     __                     __                        E   D I N B U R G H   E D
    /  )         _  _      /  ` ._/_/ . _  _  __     D I N   B U R G H   E D I
   /--<  /`~/ / / )/_)    / _. / / / / / )/ )(      I N B U R   G H   E D I N
  /___/ /  (_/ (_ (_     (__/ / / / / / /(_/__)    N B U R G H     E D I N B
 Dept. of Geography, Univ. of Edinburgh ._/       B U R G H   E D   I N B U
 Drummond Street, Edinburgh, EH8 9XP, Scotland.  U R G H   E D I N B   U R
 E-mail: BRUCE@GEOVAX.ED.AC.UK  Phone: (0)31-650 2558
===============================================================================
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On  7-JUN-1992 10:40:48.98   By user BOSS 
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. HELPMAN.COM;56
$!       2. RENUMBER.COM;21
$!       3. TOPICS_SYS.COM;5
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
X$ VERIFY = 'F$VERIFY(0)'
X$!
X$ CURR_VER  = "0.00"
X$ CURR_DATE = "13/08/90"
X$!
X$ SAY := WRITE SYS$OUTPUT
X$ ON CONTROL_Y THEN GOTO EXIT2
X$!
X$ COMMLINE = P1 + " " + P2 + " " + P3
X$ COMMLIST = ",MAIN,MERGE,DIRECTORY,EDIT,ADD,REMOVE,UPDATE,LOCAL,SYSTEM,HELP
V,EXIT,EXIT,"
X$ COMMABBR = ",MAI,MER,DIR,EDI,ADD,REM,UPD,LOC,SYS,HEL,EXI,EX,"
X$ NEEDS_UPDATE = "FALSE"
X$!PARAM_START = "TRUE"
X$ IF F$EDIT(COMMLINE,"COLLAPSE") .NES. "" THEN GOTO CLI
X$!PARAM_START = "FALSE"
X$!
X$ HELP:
X$   SAY "
X$   SAY "`5BLOCAL HELP MANAGEMENT UTILITY V''CURR_VER' - (c) BM Gittings - '
V'CURR_DATE'`5D
X$   SAY "
X$   SAY "
X$   SAY "   Valid commands are:
X$   SAY "
X$   SAY "     ADD    <file>     - Adds a Topic to the Local Help Library
X$   SAY "     REMOVE <topic>    - Remove a Topic from the Help Libraries
X$   SAY "     EDIT   <topic>    - Edit an Existing Local Topic in situ
X$   SAY "     UPDATE            - Propagates edits/adds to Main Help Library
X$   SAY "     MERGE  <in> <out> - Merge named .HLB file with Local Help Libr
Vary
X$   SAY "
X$   SAY "     LOCAL             - View the Local Help Library
X$   SAY "     MAIN              - View the Main (User) Help Library
X$   SAY "     SYSTEM            - View the System-Only Help Library
X$   SAY "     DIRECTORY         - List .HLP files in Default Directory
X$   SAY "
X$   SAY "     HELP              - Displays this Page of Information`20
X$   SAY "     EXIT              - Leaves the Alert Management Utility
X$   SAY "
X$   SAY "
X$!
X$ GET_COMMAND:
X$   INQUIRE/NOPUNCTUATION COMMLINE "HELP-MANAGER> "
X$   DUMMY = 'F$VERIFY(0)'
X$   IF COMMLINE .EQS. "" THEN GOTO GET_COMMAND
X$   COMMLINE = F$EDIT(COMMLINE,"UPCASE,TRIM,COMPRESS")
X$!
X$ CLI:
X$   PARAM2 = F$ELEMENT(2," ",COMMLINE) - " "
X$   PARAM1 = F$ELEMENT(1," ",COMMLINE) - " "
X$   PARAM3 = COMMLINE - PARAM2 - PARAM1 - F$ELEMENT(0," ",COMMLINE)
X$   COMMAND = F$EL(1+F$LOC(",''F$EX(0,3,F$EL(0," ",COMMLINE))',",COMMABBR)/4
V,",",COMMLIST)
X$   IF COMMAND .EQS. "" THEN GOTO ERROR2
X$   GOSUB 'COMMAND'
X$   ON CONTROL_Y THEN GOTO EXIT2
X$   ON WARNING THEN CONTINUE
X$!  IF PARAM_START THEN GOTO EXIT
X$   GOTO GET_COMMAND
X$!
X$ EXIT:
X$   IF NEEDS_UPDATE
X$     THEN
X$     READ/PROMPT="Leave HELPMAN without updating Main Library (Y/N)?  `5BN`
V5D: " SYS$COMMAND REPLY
X$     IF .NOT. REPLY THEN GOSUB UPDATE
X$   ENDIF
X$ EXIT2:
X$   VERIFY = F$VERIFY(VERIFY)
X$   EXIT
X$!
X$ EDIT:
X$   IF PARAM1 .EQS. "" THEN READ/PROMPT="Topic to EDIT: " SYS$COMMAND PARAM1
X$   IF PARAM1 .EQS. "" THEN GOTO GET_COMMAND
X$   ON WARNING THEN GOTO GET_COMMAND
X$   LIBRARIAN/HELP/EXTRACT=("''PARAM1'")/OUTPUT=(HLPEDIT.TMP) ADMIN$TREE:`5B
VHELP`5DGEOGRAPHY.HLB
X$   ASSIGN/NOLOG/USER SYS$COMMAND SYS$INPUT
X$   VECCE HLPEDIT.TMP
X$   LIBRARIAN/HELP/REPLACE ADMIN$TREE:`5BHELP`5DGEOGRAPHY.HLB HLPEDIT.TMP
X$   NEEDS_UPDATE = "TRUE"
X$   DELETE/NOLOG HLPEDIT.TMP;*
X$   RETURN
X$!
X$ ADD:
X$   IF PARAM1 .EQS. "" THEN READ/PROMPT="Topic to ADD: " SYS$COMMAND PARAM1
X$   IF PARAM1 .EQS. "" THEN GOTO GET_COMMAND
X$   ON WARNING THEN GOTO GET_COMMAND
X$   LIBRARIAN/HELP/REPLACE ADMIN$TREE:`5BHELP`5DGEOGRAPHY.HLB 'PARAM1'
X$   NEEDS_UPDATE = "TRUE"
X$   INQUIRE KEEP "Keep the input file ''PARAM1'?    `5BYES`5D"
X$   IF KEEP .OR. KEEP .NES. "" THEN DELETE/NOLOG 'PARAM1';*
X$   RETURN
X$!
X$ LOCAL:
X$   ASSIGN/USER SYS$COMMAND SYS$INPUT
X$   HELP/NOLIBLIST/NOINSTRUCT/PROMPT/LIBRARY=ADMIN$TREE:`5BHELP`5DGEOGRAPHY
V 'PARAM1' 'PARAM2' 'PARAM3'
X$   RETURN
X$!
X$ MAIN:
X$   ASSIGN/USER SYS$COMMAND SYS$INPUT
X$   HELP/NOLIBLIST/NOINSTRUCT/PROMPT 'PARAM1' 'PARAM2' 'PARAM3'
X$   RETURN
X$!
X$ SYSTEM:
X$   ASSIGN/USER SYS$COMMAND SYS$INPUT
X$   HELP/NOLIBLIST/NOINSTRUCT/PROMPT/LIBRARY=ADMIN$TREE:`5BHELP`5DSYSTEM 'PA
VRAM1' 'PARAM2' 'PARAM3'
X$   RETURN
X$!
X$ REMOVE:
X$   IF PARAM1 .EQS. "" THEN READ/PROMPT="Topic to REMOVE: " SYS$COMMAND PARA
VM1
X$   ON WARNING THEN GOTO GET_COMMAND
X$   IF F$ELEMENT(1,"*",PARAM1) .NES. "*"
X$     THEN
X$     OUTFIL = F$ELEMENT(0,"*",PARAM1)
X$   ELSE
X$     OUTFIL = PARAM1
X$   ENDIF
X$   LIBRARIAN/HELP/EXTRACT=('PARAM1')/OUTPUT='OUTFIL'.HLP ADMIN$TREE:`5BHELP
V`5DGEOGRAPHY.HLB
X$   LIBRARIAN/HELP/DELETE=('PARAM1') ADMIN$TREE:`5BHELP`5DGEOGRAPHY.HLB
X$   READ/PROMPT="Remove from Main Help Library too (Y/N)?  `5BNO`5D: " SYS$C
VOMMAND REPLY
X$   ON WARNING THEN CONTINUE
X$   IF REPLY THEN LIBRARIAN/HELP/DELETE=('PARAM1') SYS$HELP:HELPLIB.HLB
X$   READ/PROMPT="%HELPMAN-I-DONE, ''OUTFIL'.HLP was written;  Keep (Y/N)?  `
V5BNO`5D: " SYS$COMMAND REPLY
X$   IF .NOT. REPLY THEN DELETE/LOG 'OUTFIL'.HLP;
X$   RETURN
X$!
X$ DIRECTORY:
X$   SAY "The Help Files are:"
X$   DIRECTORY *.HLP
X$   RETURN
X$!
X$ MERGE:
X$   IF F$ELEMENT(1,".",PARAM1) .EQS "." THEN PARAM1 = PARAM1 + ".HLB"
X$   INPLIB = F$SEARCH(PARAM1)
X$   IF INPLIB .EQS. "" THEN GOTO ERROR3
X$   IF F$ELEMENT(1,".",PARAM2) .EQS "." THEN PARAM2 = PARAM2 + ".HLB"
X$   OUTLIB = F$SEARCH(PARAM2)
X$   IF OUTLIB .EQS. "" THEN GOTO ERROR4
X$   IF OUTLIB .EQS. "SYS$HELP:HELPLIB.HLB" THEN GOTO ERROR5
X$   ON WARNING THEN GOTO GET_COMMAND
X$   HELP/LIBRARY='INPLIB'/NOOUTPUT/NOPROMPT
X$   HELP/LIBRARY='OUTLIB'/NOOUTPUT/NOPROMPT
X$   LIBRARIAN/NOLOG/HELP/EXTRACT=(*) 'INPLIB'/OUTPUT=HLP.TMP
X$   LIBRARIAN/NOLOG/HELP/INSERT 'OUTLIB' HLP.TMP
X$   IF OUTLIB .EQS. "ADMIN$TREE:`5BHELP`5DGEOGRAPHY.HLB" THEN NEEDS_UPDATE =
V "TRUE"
X$   DELETE/NOLOG HLP.TMP;
X$   RETURN
X$
X$ UPDATE:
X$   LIBRARY/NOLOG/HELP/EXTRACT=(*) ADMIN$TREE:`5BHELP`5DGEOGRAPHY/OUTPUT=HLP
V.TMP
X$   LIBRARY/NOLOG/HELP/INSERT SYS$HELP:HELPLIB.HLB HLP.TMP
X$   OPEN/WRITE SUBFIL HLPMANSUB.TMP
X$   WRITE SUBFIL "$ LIBRARY/NOLOG/HELP/DATA=EXPAND ADMIN$TREE:`5BHELP`5DGEOG
VRAPHY
X$   WRITE SUBFIL "$ LIBRARY/NOLOG/HELP/DATA=EXPAND SYS$HELP:HELPLIB.HLB
X$   WRITE SUBFIL "$ PURGE/NOLOG SYS$HELP:HELPLIB.HLB,ADMIN$TREE:`5BHELP`5DGE
VOGRAPHY.HLB
X$   CLOSE/NOLOG SUBFIL
X$   SUBMIT/QUEUE=GEOVAX_SHORT/NONOTIFY/NOPRINT/NOLOG/DELETE HLPMANSUB.TMP
X$   DELETE/NOLOG HLP.TMP;
X$   NEEDS_UPDATE = "FALSE"
X$   RETURN
X$!
X$!
X$! Error Messages...
X$!
X$ ERROR2:
X$   SAY "%HELPMAN-W-IVVERB, unknown Command - ""''F$ELEM(0," ",COMMLINE)'""
V - Type HELP if required
X$   GOTO GET_COMMAND
X$!
X$ ERROR3:
X$   SAY "%HELPMAN-E-INPLIBNF, input library was not found
X$   SAY " \''PARAM1'\
X$   GOTO GET_COMMAND
X$!
X$ ERROR4:
X$   SAY "%HELPMAN-E-OUTLIBNF, output library was not found
X$   SAY " \''PARAM2'\
X$   GOTO GET_COMMAND
X$!
X$ ERROR5:
X$   SAY "%HELPMAN-E-NOTMAIN, can't let you merge directly into the Main Help
V Library
X$   GOTO GET_COMMAND
X$!
X$! Need to add TOPICS_SYS.COM and MOVE.COM (as UPDATE)
X$!      function to merge two .HLB files would be useful (extract and re-
X$!      insert)
X$!      Should be able to do the latter with a wild-card and one temp. file
X$!      During merge; if a module exists in the output .HLB it shouldn't be
X$!             over-written!
$ CALL UNPACK HELPMAN.COM;56 5185039
$ create 'f'
X$ SAY " This procedure re-number topics in a HELP file.
X$ SAY "
X$ SAY " It requires a number such as ""+ 1"" to add one
X$ SAY "                           or ""- 1"" to take one off.
X$ SAY "
X$ INQUIRE VALUE "Enter Value"
X$ INQUIRE INFILE "_File Name"
X$ OUTFILE = INFILE
X$ VALID_NUMBERS = ",1,2,3,4,5,6,7,8,9,"
X$
X$ ON CONTROL_Y THEN GOTO FINISH
X$ OPEN INFILE 'INFILE'
X$ OPEN/WRITE OUTFILE 'OUTFILE'
X$
X$ LOOP:
X$   READ/END=FINISH INFILE LINE
X$   POS = F$LOCATE(" ",LINE)
X$   NUMBER = F$EXTRACT(0,POS,LINE)
X$   IF F$LOCATE("""",NUMBER) .EQS. F$LENGTH(NUMBER)
X$     THEN
X$     IF F$LOCATE(",''NUMBER',",VALID_NUMBERS) .NE. F$LENGTH(VALID_NUMBERS)
X$       THEN
X$       NUMBER = F$INTEGER(NUMBER) 'VALUE'
X$       LINE = F$STRING(NUMBER) + F$EXTRACT(POS,F$LENGTH(LINE),LINE)
X$     ENDIF
X$   ENDIF
X$   WRITE OUTFILE LINE
X$ GOTO LOOP
X$
X$ FINISH:
X$   CLOSE/NOLOG INFILE
X$   CLOSE/NOLOG OUTFILE
X$   EXIT
$ CALL UNPACK RENUMBER.COM;21 974612763
$ create 'f'
X$! Extracts the 'system' topics out into a seperate library
X$!        - uses TOPICS_SYS.DAT which should contain the topics
X$
X$ IF F$SEARCH("EXTRACT.DIR") .EQS. "" THEN CREATE/DIR `5B.EXTRACT`5D
X$ LOOPS = 0
X$ IF F$SEARCH("`5B.EXTRACT`5D*.*") .NES. "" THEN GOTO JUST_AN_EDIT
X$ OPEN/READ DATA TOPICS_SYS.DAT
X$
X$ LOOP:
X$   LOOPS = LOOPS + 1
X$   READ/END=FINISH_UP DATA TOPIC
X$   IF F$ELEMENT(1,"#",TOPIC) .NES. "#"
X$     THEN
X$     TOPIC = F$ELEMENT(0,"#",F$EDIT(TOPIC,"COLLAPSE"))
X$     WRITE SYS$OUTPUT "*** ""''TOPIC'"" needs to be edited and reinserted b
Vy running this again"
X$     WRITE SYS$OUTPUT "                 (written to `5B.EXTRACT`5DEDIT''LOO
VPS'.HLP)
X$     LIBRARY/HELP/EXTRACT=("''TOPIC'") SYS$HELP:HELPLIB.HLB  -
X                  /OUTPUT=`5B.EXTRACT`5DEDIT'LOOPS'.HLP
X$   ELSE
X$     LIBRARY/HELP/EXTRACT=("''TOPIC'") SYS$HELP:HELPLIB.HLB  -
X                  /OUTPUT=`5B.EXTRACT`5D'LOOPS'.HLP
X$   ENDIF
X$     LIBRARY/HELP/DELETE=("''TOPIC'") SYS$HELP:HELPLIB.HLB
X$ GOTO LOOP
X$
X$ FINISH_UP:
X$   CLOSE/NOLOG DATA
X$   LIB/HELP/CREATE SYSTEM `5B.EXTRACT`5D*.*
X$   DELETE/NOLOG/EXCLUDE=(`5B.EXTRACT`5DEDIT*.HLP) `5B.EXTRACT`5D*.*;*
X$   LIBRARY/COMPRESS SYS$HELP:HELPLIB.HLB /OUT=SYS$COMMON:`5BSYSHLP`5D*.*
X$   PURGE/NOLOG SYSTEM.HLB,SYS$HELP:HELPLIB.HLB
X$   EXIT
X$!--------------------------------------------------------------------------
V-
X$
X$ JUST_AN_EDIT:
X$   INQUIRE REPLY "Insert Edited Topics back into SYS$HELP:HELPLIB.HLB?  `5B
VY/N`5D"
X$   IF REPLY THEN LIB/HELP/INSERT SYS$HELP:HELPLIB.HLB `5B.EXTRACT`5D*.*
X$   EXIT
$ CALL UNPACK TOPICS_SYS.COM;5 977281193
$ v=f$verify(v)
$ EXIT

