This example is a demonstration of how to use variables to create a system of resource management. In this example each job requires a set level of disk space for it's completion. Since there is only a limited amount of available disk space, a reservation system must be established that claims and then releases the required amount of disk space. This method can be used for any resource used by a job.
The job is initiated by the RESET job which sets the AVAILABLE variable to 100 (or the actual space available) using the resource settings. The line in Resources that sets the variable is:
set available = 100
Once the job run has begun, all job modify AVAILABLE based on the amount of disk space that the job uses. This is performed with a line like the following in the resource list:
IF AVAILABLE < 50 THEN WAIT
SET AVAILABLE = AVAILABLE - 50
The resource list commands first check the variable AVAILABLE to make sure it is greater than 50. If it is greater than 50 it subtracts 50 from the available variable so that other jobs may not run that exceed that disk space level. If the available disk space is less than 50, the job is delayed until enough available disk space becomes available. To reset the available disk space, the End Actions list contains the line:
SET AVAILABLE = AVAILABLE + 50