Launch Loop

The launch loop function selects all of the jobs up to the current time. It then loops through the selected records and launches the active jobs if they have not expired. After launching all current jobs, the launch loop fetches all future jobs sorted by start time. If the fetch succeeds, the next select time (NST) is set to the difference between the current time and the start of the next job. If the fetch fails, the NST is set to zero, which indicates that this function should be run the next time that any record is added to or updated by the F91320 table. In addition to launching jobs, the launch loop checks the control record periodically to see if it should exit.

The launch loop also looks for updates of all the schedule instances (F91320 records) and job headers (F91300 records) that it fetches. After the launch loop has processed these records, it then commits any changes and unlocks all of the records.