Description
Aborts all running jobs in the named queue. The caller must have operator privileges on the server.
Syntax
DWORD BatchAbortQueue(LPCTSTR queuename, DWORD restart);
Parameters
LPCTSTR queuename |
Specifies the name of the queue to abort. |
DWORD restart |
Specifies a flag indicating whether or not jobs may be re-scheduled for execution. If this flag is 0, the jobs are deleted. |
Return Values
BATCH_ERROR_NO_SUCH_QUEUE |
The queue does not exist. |
BATCH_ERROR_BAD_QUEUE_NAME |
The syntax of the queue name was not valid. |
BATCH_ERROR_OPERATOR_ ACCESS_DENIED |
The user does not have operator privileges. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
char * pTemp = NULL;
LPCTSTR QueName;
DWORD ReturnVal = 0;
DWORD Status = 0;
cout << "STARTING THE EXECUTION OF BATCHABORTQUEUE API "<< endl;
pTemp = new char[ MAX_LENGTH];
if (pTemp == NULL){
cout << " Unable to allocate the memory.\n Exiting the program "<<endl;
exit(0);
}
cout << " Enter the name of the QUEUE to Abort"<< endl;
cin >> pTemp;
QueName = (const char *)pTemp;
cout << " Enter the status whether to restart or not"
<< " 0 for DELETION 1 for Restarting "<< endl;
cin >> Status;
ReturnVal = BatchAbortQueue( QueName,Status);
switch(ReturnVal)
{
case BATCH_ERROR_NO_SUCH_QUEUE :
cout << " The queue does not exist. " << endl;
break;
case BATCH_ERROR_BAD_QUEUE_NAME :
cout << " The syntax of the queue name was not valid. " << endl;
break;
case BATCH_ERROR_OPERATOR_ACCESS_DENIED :
cout << " The user does not have operator privileges. " << endl;
break;
default:
cout << "SUCCESSFUL COMPLETION OF ABORTING THE QUEUE "<< endl;
}
cout << "COMPLETED THE EXECUTION OF BATCHABORTQUEUE API "<< endl;
delete [] pTemp;
}