Description
Moves a batch job from one queue to another on the same server. The caller must own the job, or have operator privileges. The caller must have submit access to the destination queue.
Syntax
DWORD BatchMoveJob(LPCTSTR jobid, LPCTSTR toqueue);
Parameters
LPCTSTR jobid |
Specifies the unique job-identification string. |
LPCTSTR toqueue |
Specifies the queue to which the job will move. The queue must exist on the same server as the job. A job cannot be moved between servers. The value of toqueue must be a simple text string and not the full remote queue specification. |
Return Values
BATCH_ERROR_NO_SUCH_JOB |
The system could not find the named job. |
BATCH_ERROR_BAD_JOB_NAME |
The jobid syntax was incorrect. |
BATCH_ERROR_NO_SUCH_QUEUE |
The system could not find the named queue. The queue does not exist on the same server as the job. |
BATCH_ERROR_QUEUE_ACCESS_DENIED |
The user does not have access to the named queue. |
BATCH_ERROR_QUEUE_NOT_ENABLED |
The destination queue is not enabled, and jobs may not be moved into it. |
BATCH_ERROR_QUEUE_RUN_PRIORITY_EXCEEDED |
The job's run priority is higher than the queue's run priority. |
BATCH_ERROR_JOB_IS_RUNNING |
The job is already running. |
BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED |
The user does not own the job, and does not have operator privileges on the system. |
Example Program
#include <iostream.h>
#include "batchapi.h"
#define MAX_LENGTH 25
void main()
{
DWORD ReturnVal;
LPCTSTR JobDest;
LPCTSTR JobId;
char * pTemp =NULL;
char * pTempDest=NULL;
cout << " STARTED EXECUTION OF BATCHMOVEJOB API " << endl;
pTemp = new char[MAX_LENGTH];
if (pTemp == NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
exit(0);
}
pTempDest = new char[MAX_LENGTH];
if (pTempDest == NULL){
cout << "unable to allocate the memory.\n Exiting the program"<<endl;
delete [] pTemp;
exit(0);
}
cout << " Enter the Job id which needs to be moved ";
cin >> pTemp;
JobId = (const char *)pTemp;
cout << " Enter the QueName to which the job should be moved ";
cin >> pTempDest;
JobDest = (const char *)pTempDest;
ReturnVal = BatchMoveJob( JobId , JobDest );
switch (ReturnVal)
{
case BATCH_ERROR_NO_SUCH_JOB :
cout << " The system could not find the named job. " << endl;
break;
case BATCH_ERROR_BAD_JOB_NAME :
cout << " The jobid syntax was incorrect. " << endl;
break;
case BATCH_ERROR_NO_SUCH_QUEUE :
cout << " The system could not find the named queue."
<< The queue does not exist on the same server as the job. " << endl;
break;
case BATCH_ERROR_QUEUE_ACCESS_DENIED :
cout << " The user does not have access to the named queue. " << endl;
break;
case BATCH_ERROR_QUEUE_NOT_ENABLED :
cout << " The destination queue is not enabled, and jobs may not be moved into it. " << endl;
break;
case BATCH_ERROR_QUEUE_RUN_PRIORITY_EXCEEDED :
cout << " The job's run priority is higher than the queue's run priority." << endl;
break;
case BATCH_ERROR_JOB_IS_RUNNING :
cout << "The job is already running. " << endl;
break;
case BATCH_ERROR_OWNER_OR_OPERATOR_ACCESS_DENIED :
cout << " The user does not own the job, and does not have operator privileges on the system. " << endl;
break;
default:
cout << "SUCCESSFUL MOVE OF THE JOB"<< endl;
}
cout << " COMPLETED EXECUTION OF BATCHMOVEJOB API " << endl;
delete [] pTemp;
delete [] pTempDest;
}