BatchJobRelease - Intergraph Batch Services - Help

Intergraph Batch Services Help

Language
English
Product
Intergraph Batch Services
Search by Category
Help

Description

Removes a user or manager hold on a job, freeing it for execution. To remove a BATCH_USER_HOLD from the job, the caller must own the job. To remove a BATCH_MGR_HOLD, the caller must have operator privileges.

Syntax

DWORD BatchJobRelease(LPCTSTR jobid, DWORD holdtype);

Parameters

LPCTSTR jobid

Specifies the unique job-identification string.

DWORD holdtype

Specifies the hold type, either BATCH_USER_HOLD or BATCH_MGR_HOLD, or both.

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_OWNER_OR_

OPERATOR_ACCESS_DENIED

The user is trying to release a user hold, but is not the job owner and does not have at least operator privilege.

BATCH_ERROR_INVALID_HOLD

An invalid hold type was specified.

BATCH_ERROR_JOB_IS_RUNNING

The job is already running.

Example Program

#include < iostream.h>

#include "batchapi.h"

#define MAX_LENGTH 25

void main()

{

LPCTSTR JobId;

char * pTemp;

DWORD HoldType;

DWORD ReturnVal;

cout << " STARTED EXECUTION OF BATCHJOBRELEASE API" << endl;

pTemp = new char[MAX_LENGTH];

if (pTemp == NULL){

cout << "unable to allocate the memory.\n Exiting"<<endl;

exit(0);

}

cout << " Enter the Job id for which to get the info ";

cin >> pTemp;

JobId = (const char *)pTemp;

cout << endl << " Enter the Job Hold type to release"

<< " 0 for BATCH_USER_HOLD 1 for BATCH_MGR_HOLD, 2 for both" << endl;

cin >> HoldType;

switch (HoldType)

{

case 0 : // the Jobs hold type is only Userhold

ReturnVal=BatchJobRelease( JobId, BATCH_USER_HOLD);

break;

case 1: // the Jobs hold type is only ManagerHold

ReturnVal=BatchJobRelease( JobId, BATCH_MGR_HOLD);

break;

case 2: // the Jobs hold type is both Userhold & ManagerHold

ReturnVal=BatchJobRelease( JobId, BATCH_USER_HOLD && BATCH_MGR_HOLD);

break;

default:

cout << " THE HOLD TYPE IS UNKNOWN" << endl;

}

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_OWNER_OR_OPERATOR_ACCESS_DENIED :

cout << " The user is trying to release a user hold, but is not the job "

<<" owner and does not have at least operator privilege. " <<endl;

break;

case BATCH_ERROR_INVALID_HOLD :

cout << " An invalid hold type was specified. " << endl;

break;

case BATCH_ERROR_JOB_IS_RUNNING :

cout << " The job is already running. " << endl;

break;

default :

cout << " SUCCESSFUL COMPLETION OF RELEASE OF JOB"<< endl;

}

cout << " COMPLETED EXECUTION OF BATCHJOBRELEASE API" << endl;

delete [] pTemp;

}