![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: I would like to have a command be submitted from within another command file depending on the status that the print job has completed. Lexical functions may be the way to go, but I'm confused. SYNCHRONIZE seems only to work with one BATCH job depending on another BATCH jobs' success and/or failure. Please reply....thanks in advance.... The Answer is : According to HELP: SYNCHRONIZE Holds the process issuing the command until the specified job completes execution. Requires delete (D) access to the specified job. Format SYNCHRONIZE [job-name] The "job" may be a batch or print job. You can therefore determine the completion status of a print job as follows: $ PRINT somefile $ SYNCHRONIZE/ENTRY='$ENTRY' ! $ENTRY contains the entry of the $ ! most recently requested job $ status=$STATUS ! Save completion status $ IF status ! test completion status $ THEN $ ! Print job was successful $ ELSE $ ! Print job failed $ ENDIF Note that the above code has a potential race condition. If the print job completes very quickly, the SYNCHRONIZE command may return "%JBC-E-NOSUCHENT, no such entry" (if it executes after the job has completed). A safer command sequence is therefore: $ PRINT/RETAIN=ALWAYS somefile ! Make sure job is retained $ SYNCHRONIZE/ENTRY='$ENTRY' ! $ENTRY contains the entry of the $ ! most recently requested job $ status=$STATUS ! Save completion status $ DELETE/ENTRY='$ENTRY' ! Clean up the entry $ IF status ! Test completion status $ THEN $ ! Print job was successful $ ELSE $ ! Print job failed $ ENDIF The SYNCHRONIZE command may be executed as many times as you like after the job has completed but before the entry has been deleted. It will return the completion status of the job immediately.
|