1 IFMOD_
 The function of this program is to compare the modification dates of
 specified files and depending on whether the results are true or false
 execute a specified DCL command (similar to the DCL IF command).  This
 is a poor mans Module Management System (DEC/MMS).

 Syntax:

    $ IFMOD :== $disk:[directory]IFMOD
    $ IFMOD  file_list  operator  file_list THEN dcl_command

 The basic idea is:  If file A is used to generate file B, then IFMOD
 can be used to determine if file A has been changed (since the last
 time file B was created) and re-generate file B if necessary.

2 Parameters
 SPECIAL NOTE:  To avoid syntax confusion between connectors and
    file specifications it is strongly suggested that a space or tab
    seperate the file_list's from the operators and connectors.

 file_list - file-spec[,file-spec,...]

 file-spec[,file-spec,...] - is a list of file names seperated by
    commas that are to have their modification dates fetched.

    The highest date from the list of files specified is saved for
    comparison.

    The disk, directory, filename, and file type default from the
    previous file in the list.  The first file in the list always
    takes its disk and directory defaults from the current default
    directory.

    Full directory and file wild carding is supported ('...', '-',
    '*', and '%').

 operator - is on of the following:

        .LT.    .LE.    .EQ.    .NE.    .GE.    .GT.

    and they are used to control the comparision of the resulting
    modification dates from the two lists of file names.  A true
    or false value will be the result of the compare.

 .OR. - is a connector which allows for the comparison of additional
    files in the same IFMOD command.  The result is OR'ed to the
    result of the previous comparison.

       $ IFMOD file_list operator file_list    .OR. -
               file_list operator file_list    THEN dcl_command

 .AND. - is a connector which allows for the comparison of
    additional files in the same IFMOD command.  The result is
    AND'ed to the result of the previous comparison.

       $ IFMOD file_list operator file_list    .AND. -
               file_list operator file_list    THEN dcl_command

 .NOT. - is a modifier which will negate the true/false value of the
    comparison which follows it.

       $ IFMOD .NOT. (file_list operator file_list) THEN dcl_command

 THEN - is used to indicate the end of the comparison operations.
     When this is encountered, if the result of the previous
     comparisons was true then the DCL command that follows is
     executed, otherwise, it is not.

2 Parentheses
 Parentheses are allowed and work the way you would expect.
 Parentheses will force the operations within to be of higher
 precedence than the operations preceeding them.

2 Operator_Precedence
 Operator Precedence:

    .LT.    4        (high)
    .LE.    4
    .EQ.    4
    .NE.    4
    .GE.    4
    .GT.    4

    .NOT.   3
    .AND.   2
    .OR.    1        (low)

 Parentheses will force the operations within to be of higher
 precedence than the operations preceeding them.

2 Example_1
 The following is an example using IFMOD in a build proc:

    $ IFMOD := $disk:[directory]IFMOD /ECHO /ERROR=(.TRUE.)
    $!
    $ IFMOD  WHO.FOR .GT. WHO.OBJ  THEN  FORTRAN WHO.FOR
    $!
    $ IFMOD  WHO.OBJ .GT. WHO.EXE THEN LINK WHO

2 Example_2
 The following is an example using IFMOD in a build proc:

    $ IFMOD := $disk:[directory]IFMOD
    $!
    $ IFMOD/ERROR=(.FALSE.) -
             (TEST.FOR,TEST.INC) .LT. TEST.OBJ THEN GOTO ENDIF_CMPL
    $    FORTRAN/LIST TEST.FOR
    $    PRINT/DELETE TEST.LIS
    $ ENDIF_CMPL:
    $!
    $ IFMOD/ERROR=(.FALSE.) -
             TEST1.MAR .LT. TEST1.OBJ THEN GOTO ENDIF_ASM
    $    MACRO/LIST TEST1.MAR
    $    PRINT/DELETE TEST1.LIS
    $ ENDIF_ASM:
    $!
    $ IFMOD/ERROR=(.FALSE.) -
             (TEST.OBJ,TEST1.OBJ) .LT. TEST.EXE THEN -
                     GOTO ENDIF_LINK
    $    LINK/MAP/FULL TEST,TEST1
    $    PRINT/DELETE TEST.MAP
    $ ENDIF_LINK:

2 Example_3
 The following is an example using IFMOD in a build proc to maintain
 an object module library:

    $ IFMOD := $disk:[directory]IFMOD /ERROR=(.TRUE.) /ECHO
    $!
    $ IFMOD -
       QPARAM.FOR .GT. IPSSLIB.OLB/INCLUDE=(Q_PARAM) THEN -
            FORTRAN/LIST QPARAM.FOR
    $ IFMOD -
       QSTRING.FOR .GT. IPSSLIB.OLB/INCLUDE=(Q_STRING) THEN-
            FORTRAN/LIST QSTRING.FOR
    $ IFMOD -
       QUPCASE.FOR .GT. IPSSLIB.OLB/INCLUDE=(Q_UPCASE) THEN-
            FORTRAN/LIST QUPCASE.FOR
    $!
    $ IFMOD (QPARAM.OBJ,QSTRING,QUPCASE) .GT. -
       IPSSLIB.OLB/INCLUDE=(Q_PARAM,Q_STRING,Q_UPCASE) THEN-
            LIBRARY  IPSSLIB/OBJECT  QPARAM,QSTRING,QUPCASE

2 Example_4
 The following is a real command procedure used to build the IFMOD
 program itself:

    $ verify = 'f$verify("NO")'
    $ if "''ifmod_verify'" then set verify
    $!--------------------------------------------------------------
    $!   IFMOD.BLD - The function of this command procedure is to
    $!      build an executable image of the program IFMOD.  It will
    $!      test for modules which have changed and re-compile
    $!      (assemble) and Link the modules.
    $!
    $!      P1 - if specified, then P1 contains qualifiers for the
    $!          LINK command to override the default qualifiers.
    $!          The first qualifier is not to contain a / since it
    $!          will be added by the proc.  This is done because
    $!          invoking the command procedure with a P1 value that
    $!          begins with a / confuses DCL and it thinks the /
    $!          qualifier is for the command procedure invocation.
    $!--------------------------------------------------------------
    $! 22-Jan-1984      R. A. Harris    Initial Coding.
    $!--------------------------------------------------------------
    $ on error then goto abort
    $ on control_y then goto abort
    $!
    $!    Suppress printing batch log file and set default directory
    $!      to where source is located.
    $!
    $ if f$mode() .eqs. "BATCH" then assign nla0: sys$print
    $ if f$mode() .eqs. "BATCH" then set default [.ifmod]
    $!
    $!    Create a foreign symbol for IFMOD (boot strapping itself).
    $!      "SYS$COM:" is a logical name which is assigned to the
    $!      disk and directory where an executable copy of IFMOD is
    $!      stored.
    $!
    $ ifmod := $sys$com:ifmod/error=(.true.)/echo
    $!
    $!    Define default qualifiers for compiles and assembles.
    $!      This is done in such a way that simple changes to the
    $!      command procedure can change the defaults to ones
    $!      desirable for debugging enhancements to the program.
    $!
    $ macro := macro/nolist
    $ !!!! macro := macro/nolist/debug
    $ !!!! macro := macro/list/debug
    $!
    $ message := message/nolist
    $ !!!! message := message/list
    $!
    $ link := link/notrace/nodebug
    $ !!!! link := link/notrace/debug
    $ !!!! link := link/trace/debug
    $ if p1 .nes. "" then link := 'link'/'p1'
    $!
    $!    Set up to compile and assemble the progarm.  If errors are
    $!      detected then and error flag is set to yes.
    $!
    $ error := no
    $ on error then error := yes
    $!
    $ ifmod ifmod.mar    .gt. ifmod.obj    then $ 'macro'   ifmod
    $ ifmod ifmodrms.mar .gt. ifmodrms.obj then $ 'macro'   ifmodrms
    $ ifmod ifmodlib.mar .gt. ifmodlib.obj then $ 'macro'   ifmodlib
    $ ifmod ifmodmsg.msg .gt. ifmodmsg.obj then $ 'message' ifmodmsg
    $!
    $ if error then goto abort          ! if errors, abort
    $ on error then goto abort          ! set up new on error action
    $!
    $!    Link the program.
    $!
    $ ifmod/error=(.false.)/noecho -
         (ifmod.obj,ifmodrms,ifmodlib,ifmodmsg) -
            .lt. ifmod.exe then goto endif_link
    $    v = f$verify("YES")
    $    'link' sys$input:/options
                ifmod,-
                ifmodrms,-
                ifmodlib,-
                ifmodmsg
    $ endif_link:       !'f$verify(V)'
    $!
    $ if error then goto abort  ! check for link errors.
    $ goto exit
    $!
    $!    Abort.
    $!
    $ abort:
    $   if verify then set verify       !'f$verify("NO")'
    $   exit 4
    $!
    $!    Exit.
    $!
    $ exit:
    $   if verify then set verify       !'f$verify("NO")'

2 Qualifiers
/NOECHO
/ECHO
 This qualifier will cause IFMOD to echo to SYS$OUTPUT: the command
 that follows the 'THEN' parameter, if and only if the command is
 passed to DCL for execution.

 This is a command qualifier and must be located immediately
 following the IFMOD command and before the first 'file_list'.

/ERROR=label
 This qualifier will cause the command to return control at the
 specified 'label' if one of the files specified has not been found.
 This is very useful if say the object files were deleted since the
 last time the program was built.  This could be used to force
 control to the compile phase reguardless of whether other files did
 exist.

 This is a command qualifier and must be located immediately
 following the IFMOD command and before the first 'file_list'.

 If this qualifier is not specified and a specified file is not found
 then an error will be issued and the command will abort.

 If 'label' is specified as .TRUE. or .FALSE. then the following
 will happen if a file is not found:

     .TRUE.  - Assume the comparisons were true and execute the DCL
               command following the 'THEN'.     .TRUE. may also be
               specified as .T.

     .FALSE. - Assume the comparisons were false and exit the
               program normally (the DCL command following the
               'THEN' would NOT be executed).    .FALSE. may also
               be specified as .F.

/INCLUDE=(module,...)
 This file_spec qualifier specifies that the file it follows is a
 library file (OBJECT, TEXT, HELP, or MACRO library) and that the
 insertion dates for the list of 'modules' specified are to be
 extracted for comparison.

 NOTE:  The dates are the module insertion dates and have NO (NONE,
        ZERO, ZILCH) relation to the original input file's
        modification date.

/NOLOG
/LOG
 This qualifier specifies that the date fetched for each file (or
 library module) be logged to SYS$OUTPUT:

 This is a command qualifier and must be located immediately
 following the IFMOD command and before the first 'file_list'.

