BatchAbortJob - Intergraph Batch Services - Help

Intergraph Batch Services Help

Language
English
Product
Intergraph Batch Services
Search by Category
Help

Description

Aborts the execution of a running job. The caller must either own the job, or have operator privileges on the server on which the job is running.

Syntax

DWORD BatchAbortJob(LPCTSTR jobid, DWORD restart, LPCTSTR reserved);

Parameters

LPCTSTR jobid

Specifies the unique job-identification string.

DWORD restart

Specifies a flag indicating whether or not the job may be re-scheduled for execution. If the value is 0, the job is deleted.

LPCTSTR reserved

This parameter is reserved for future use, and is currently ignored.

Return Values

BATCH_ERROR_JOB_NOT_RUNNING

The job is not running. Use BatchDeleteJob to cancel a job that is not running.

BATCH_ERROR_NO_SUCH_JOB

The system could not find the named job.

BATCH_ERROR_BAD_JOB_NAME

The jobid was null or the syntax was incorrect.

BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED

The caller neither owns the job nor has operator privileges.

Example Program

#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25

void main()

{

LPCTSTR FirstArg;
LPCTSTR LastArg = NULL;
TCHAR * pJobId;
DWORD ReturnVal = 9999;
DWORD Restart = 0;
DWORD SigNo = NULL;

cout << " STARTING OF BATCHABORTJOB API " << endl;

pJobId = new TCHAR [ MAX_LENGTH ];
if (pJobId==NULL){

cout << "Unable to allocate the Memory.\n Exiting the program"<<endl;
exit(0);

}

cout << " Enter the job-id of the job to Abort ";
cin >> pJobId;

FirstArg = (const TCHAR *)pJobId;

ReturnVal = BatchAbortJob ( FirstArg , Restart , SigNo , LastArg );

switch ( ReturnVal)

{

case BATCH_ERROR_JOB_NOT_RUNNING:

cout << " The job is not running. Use BatchDeleteJob to cancel a job that is not running : " << FirstArg << endl;

break;

case BATCH_ERROR_NO_SUCH_JOB:

cout << " The system could not find the named job : " << FirstArg << endl;

break;

case BATCH_ERROR_BAD_JOB_NAME:

cout << " The jobid was null or the syntax was incorrect : " << FirstArg << endl;

break;

case BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED:

cout << " The caller neither owns the job nor has operator privileges. : " << FirstArg << endl;

break;

case 0:

cout << "JOB HAS BEEN SUCCESSFULLY ABORTED" <<endl;

break;

default:

cout << "Abort of the job couldn't be completed.\nThe call returned "<<ReturnVal<<endl;

}

cout << " FINISHED EXECUTING OF BATCHABORTJOB API " <<endl;

delete [] pJobId;

}