$!
$! This command procedure can be used to link Hercules and
$! it's associated utilities.
$!
$! Peter Coghlan    November 2020
$!
$! The first argument specifies the file or set of files to
$! be linked as per the examples below.
$!
$! The second to eighth arguments specify optional additional
$! qualifiers passed to the compiler.  Take care if using
$! qualifiers such as /THREADS_ENABLE which are already
$! specified on the link command in the "link" subroutine
$! below as the values already specified will be overridden
$! which may cause difficulties.
$!
$! To link just HERCULES.EXE:
$!
$! @LINK HERCULES
$!
$! To link just the additional utilities; e.g. DASDINIT;
$!
$! @LINK UTILITIES
$!
$! To link just one of the utilities, e.g. dasdcat:
$!
$! @LINK DASDCAT
$!
$! To link Hercules in debug mode with a link map:
$!
$! @LINK HERCULES /DEBUG /MAP
$!
$! To link Hercules and the associated utilities:
$!
$! @LINK ALL
$!
$ If p1 .Eqs. "" .Or. p1 .Eqs. "?" .Or. p1 .Eqs. "HELP"
$ Then
$     Write Sys$Output ""
$     Write Sys$Output "Use this procedure to link Hercules and/or the associated utilities"
$     Write Sys$Output ""
$     Write Sys$Output "Usage:"
$     Write Sys$Output "    @Link <module>  [<qualifiers>...]"
$     Write Sys$Output "    @Link <fileset> [<qualifiers>...]"
$     Write Sys$Output "    @Link   ALL     [<qualifiers>...]"
$     Write Sys$Output ""
$     Write Sys$Output "For example:"
$     Write Sys$Output ""
$     Write Sys$Output "    @Link Hercules"
$     Write Sys$Output "    @Link Utilities"
$     Write Sys$Output "    @Link Dasdinit"
$     Write Sys$Output "    @Link All"
$     Write Sys$Output "    @Link Hercules /Debug/Trace/Map"
$     Write Sys$Output ""
$ Exit 1
$ Endif
$!
$ Call Link HERCULES  HERCULES 'p1' /Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES CCKDCDSK 'p1' ,Cckd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES CCKDCOMP 'p1' ,Cckd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES CCKDSWAP 'p1' ,Cckd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDCAT  'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDCOPY 'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDINIT 'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDISUP 'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDLOAD 'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDLS   'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DASDPDSU 'p1' ,Dasd/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES DMAP2HRC 'p1' ,Basic/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES HETGET   'p1' ,Het/Option  'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES HETINIT  'p1' ,Het/Option  'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES HETMAP   'p1' ,Het/Option  'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES HETUPD   'p1' ,Het/Option  'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES TAPECOPY 'p1' ,Tape/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES TAPEMAP  'p1' ,Tape/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ Call Link UTILITIES TAPESPLT 'p1' ,Tape/Option 'p2' 'p3' 'p4' 'p5''p6''p7''p8'
$ 
$ Link: Subroutine
$
$ If P3 .Nes. P1 .And. P3 .Nes. P2 .And. P3 .Nes. "ALL" Then Exit 1
$
$ File1 = F$Search("''P2'.OBJ")
$ File2 = F$Search("''P2'.OPT")
$
$ If File1 .Eqs. "" .And. File2 .Eqs. ""
$ Then
$   Write Sys$Output "No object file or option file present for ''P2'."
$ Else
$   Write Sys$Output "Linking ''P2' ..."
$   Link /Threads_Enable 'P2' 'P4' 'P5' 'P6' 'P7' 'P8'
$ Endif
$
$ Exit $Status
$ EndSubroutine