Description
Creates a batch queue on a batch server. The caller must have management privileges on the server. The queue is described by the BATCH_QUEUE_INFO_2 structure. Default values for this structure have been defined, see BatchCreateQueue Default BATCH_QUEUE_INFO_2 Values.
Syntax
DWORD BatchCreateQueue(LPCTSTR queue, BATCH_QUEUE_INFO_2 qinfo);
Parameters
LPCTSTR queue |
Specifies the full name of the queue to create. |
BATCH_QUEUE_INFO_2 qinfo |
Points to a structure describing the queue. |
Return Values
BATCH_ERROR_ALREADY_EXISTS |
The queue already exists |
BATCH_ERROR_BAD_QUEUE_NAME |
The syntax of the queue name was not valid. |
BATCH_ERROR_BAD_QUEUE_TYPE |
The queue type was neither pipe nor batch. |
BATCH_ERROR_MANAGER_ ACCESS_DENIED |
The user does not have manager privileges. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
LPCTSTR QueName;
DWORD TempVar=NULL;
DWORD ReturnVal=NULL;
char * pTempName;
BATCH_QUEUE_INFO_2 NewQue;
cout << " STARTED EXECUTION OF BATCHCREATEQUEUE API"<< endl;
pTempName = new char[ MAX_LENGTH];
if ( pTempName ==NULL ){
cout << "Unable to allocate the memory."<<endl;
exit(0);
}
cout << " Enter the Queue Name to be created ";
cin >> pTempName;
QueName = (const char *)pTempName;
cout << " Enter the Queue Type 1 PIPE QUEUE 2 for BATCH QUEUE ";
cin >> TempVar;
if (TempVar == 1)
NewQue.qtype = BATCH_QUEUE_TYPE_PIPE;
else
if (TempVar == 2)
NewQue.qtype = BATCH_QUEUE_TYPE_BATCH;
else
NewQue.qtype = 3;
cout << " Enter the priority type ";
cin >> TempVar;
NewQue.qpri = TempVar;
cout << " Enter the Max Running Jobs Limit ";
cin >> TempVar;
NewQue.runlimit = TempVar;
NewQue.pSD = NULL;
if ( NewQue.qtype == 2){
NewQue.defaultpri = 31;
NewQue.sizelimit = 1000000;
}
else
if (NewQue.qtype == 1) {
NewQue.defaultpri = 0;
NewQue.sizelimit = 0;
}
ReturnVal = BatchCreateQueue( QueName , NewQue);
switch (ReturnVal)
{
case BATCH_ERROR_ALREADY_EXISTS :
cout << " The queue already exists " << endl;
break;
case BATCH_ERROR_BAD_QUEUE_NAME :
cout << " Queue name was not valid. " << endl;
break;
case BATCH_ERROR_BAD_QUEUE_TYPE :
cout << " The queue type was neither pipe nor batch. " << endl;
break;
case BATCH_ERROR_MANAGER_ACCESS_DENIED :
cout << " The user does not have manager privileges. " << endl;
break;
default:
cout << "SUCCESSFUL COMPLETION OF CREATEQUEUE "<< endl;
}
cout << " COMPLETED EXECUTION OF BATCHCREATEQUEUE API"<< endl;
delete [] pTempName;
}