Launch and monitor a Job Instance


Inputs:  Parm1 = Job Instance UJP pathname
         Parm2 = 'CANCEL' to cancel monitored launch,
                   or 'FAIL n', else empty
         Parm3 = Window handle to send progress messages

Returns: Launch count or <0 if error
          -1 = Launch already in progress or completed
          -3 = No lines in list file(s)
          -4 = Cannot load job instance properties
          -5 = Missing or duplicate $DNS_file command
          -6 = Missing or invalid DNS file
          -7 = Voiceout files with no infobox number
          -8 = Pollout files with no mailbox number
         -11 = Invalid or missing TOSEND directory
         -12 = No fax files to send and no cover sheet
         -13 = All lines in list file have been excluded
         -14 = Cannot get NEXTFS number after 20 attempts
         -15 = Cannot delete an FS file prior to rename
         -16 = Cannot rename .TFS file to .FS file
         -17 = No record to send as proof

This function is intended only for use from the JOBADMIN program.  It uses a separate thread to process the launch, and returns immediately. For more information about the launch process, see the description of the Launch function.

Windows messages are posted to the passed window handle with the following parameters:

Msg:WM_USER + 7
wParam:Number of items already launched
lParam:Total number of items in the job instance

If an error occurs during the launch which causes the launch to terminate, the negative error number will be returned in both parameters.

The calling program should treat wParam=lParam as an indication that the launch has finished. Until the last message for the launch, messages are only sent after every ten items have been launched.  If the monitored launch is cancelled by setting parm2 to CANCEL, then both message parameters will be set to the number of items already launched.

To cancel a launch, the passed window handle must be the same as that passed when the monitored launch was initiated. Launching multiple jobs concurrently in monitored mode is neither supported nor prevented.

Job Status:

Before the launch, job status is set to 25 (launch in progress).

If the monitored launch is cancelled, job status is set to 32 (suspended)

If the launch terminates on error, job status is set to 29 (launch failed)

If the job is suspended during launch, job status is set to 32 (suspended) on launch termination

After the launch terminates normally, job status is set to 30 (active)

For details of the 'FAIL n' option, see Launch.