From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 14-AUG-1989 13:09
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Re: RE: How to chain batch jobs?

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Mon, 14 AUG 89 08:21:17 PDT
Received: from DSRM12.STEVENS-TECH.EDU ([192.12.216.35]) by KL.SRI.COM with TCP; Mon, 14 Aug 89 07:30:08 PDT
Date: Mon, 14 Aug 89 10:26:45 EDT
From: DSTEVENS@DSRM12.STEVENS-TECH.EDU (David L. Stevens)
To: lupine!infopiz!mark@uunet.uu.net, info-vax@kl.sri.com
Subject: Re: RE: How to chain batch jobs?
X-Vms-To: Q%"lupine!infopiz!mark@uunet.uu.net  (Mark Pizzolato 415-369-9366)"
Message-Id: <89714102646.25e.DSTEVENS>


 I don't think I've seen this solution thrown out for the problem yet, so here
 I go.  Why not create a chain command procedure that takes as arguements, the
 command files you want chained.  Run the Chain procedure, with the procedures
 you want to execute specified as arguements.  The Chain program will then
 submit itself to batch where it will execute procedure P1, and then resubmit
 itself starting at P2.  When it finds no P1 arguement, it will stop.  Here is
 how you would start it out:


    $ @CHAIN.COM "A.COM" "B.COM" "C.COM" ...


 The advantages are the following:
      1) No extra processes will be created.  I.E. no use of $synch
      2) Ability to resource account for each procedure, slight overhead
           due to command procedure
      3) No changes made to original command procedures.
      4) Batch processes identified as job name CHAIN_command-file-name

 Limitations:
      1) No way to pass arguements to any of the command procedures.
      2) Can only chain 8 jobs at a time


 Below is what the procedure would look like.

---------------------Cut Here--------------------------------------------------
$!
$!           CHAIN    v1.0
$!
$! ABSTRACT:
$!
$!   This command procedure can be used to submit and run in sequence a series
$!     of command procedures.
$!
$! AUTHOR:
$!   David L. Stevens
$!   Stevens Institute of Technology
$!
$!*****************************************************************************
$
$ !
$ ! If this is interactive, then we are setting the job up
$ !
$ IF F$MODE .EQS. "BATCH"   THEN GOTO PROCESS_BATCH
$ IF F$MODE .EQS. "NETWORK" THEN EXIT
$ !
$ ! Submit the job to run in batch
$ !
$ SUBMIT/KEEP/NOPRINT/RESTART -
        /PARAM=("''P1'", "''P2'", "''P3'", "''P4'", -
                "''P5'", "''P6'", "''P7'", "''P8'") -
        /NAME="CHAIN_''F$FILE(P1,,,"NAME")'" -
        CHAIN.COM
$ !
$ ! Exit
$ !
$ EXIT $status
$ !
$ ! This is the BATCH section that does the actual work
$ !
$PROCESS_BATCH:
$ !
$ ! First see if there are any Command Procedures to execute
$ !
$ IF P1 .EQS. "" THEN EXIT
$ !
$ ! Execute the command procedure pointed at by P1
$ !
$ @'P1
$ !
$ ! Now if there are no more procedures to be executed, lets exit
$ !
$ IF P2 .EQS. "" THEN EXIT
$ !
$ ! Now lets resubmit ourself, so that we can execute the next procedure
$ !  Wait 5 minutes before executing the next procedure. (this is optional)
$ !
$ SUBMIT/KEEP/NOPRINT/RESTART -
        /AFTER="+00:05:00"    -
        /PARAM=("''P2'", "''P3'", "''P4'", "''P5'", "''P6'", "''P7'", "''P8'") -
        /NAME="CHAIN_''F$PARSE(P2,,,"NAME")'" -
        CHAIN.COM
$ !
$ ! And now Exit
$ !
$ EXIT $status
$
---------------------------Cut Here--------------------------------------------

===============================================================================
|                                 |                                           |
| David L. Stevens                | CCnet:    SITVXC::DSTEVENS                |
| Senior Systems Programmer       | BITnet:   DSTEVENS@STEVENS                |
| Stevens Institute of Technology | INTERnet: DSTEVENS@DSRM12.STEVENS-TECH.EDU|
|                                 |                                           |
===============================================================================
[ ...self realization, I was thinking of those immortal words of Socrates     ]
[    when he said: 'I drank what ?'     -   Val Kilmer  -  Real Genius        ]

------------

