BatchGetJobInfo - Intergraph Batch Services - Help

Intergraph Batch Services Help

Language
English
Product
Intergraph Batch Services
Search by Category
Help

Description

Returns information about a particular job.

Structure

DWORD BatchGetJobInfo(LPCTSTR jobid, DWORD level, LPBYTE buff, DWORD cbsize, LPDWORD cbneeded);

Parameters

LPCTSTR jobid

Specifies the unique job-identification string.

DWORD level

Specifies the amount to information to be returned for each job. Currently, only levels 1 and 2 are supported, which correspond to the BATCH_JOB_INFO_1 and BATCH_JOB_INFO_2 structures, respectively.

LPBYTE buff

Buffer space to store a BATCH_JOB_INFO structure.

DWORD cbsize

Specifies the size of the buffer in bytes.

LPDWORD cbneeded

Specifies the size of the returned information. If cbsize is too small, ERROR_INSUFFICIENT_BUFFER is returned, and cbneeded is set to the needed size.

Return Values

BATCH_ERROR_NO_SUCH_JOB

The system could not find the named job.

ERROR_INVALID_LEVEL

The level parameter is not 1 or 2.

BATCH_ERROR_BAD_JOB_NAME

The jobid was null or the syntax was incorrect.

Example Program

#include <iostream.h>

#include "batchapi.h"

#define MAX_LENGTH 25

void main()

{

LPCTSTR JobId=NULL;

LPBYTE Buff;

char * pTemp=NULL;

DWORD ReturnVal=0;

DWORD Level;

DWORD Need;

DWORD CbSize;

cout << " STARTING THE EXECUTION OF BATCHGETJOBINFO API " << endl;

CbSize= BATCH_JOB_ID_SIZE + 4;

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 << " Enter the Level of Extraction ( 1 or 2) ";

cin >> Level;

ReturnVal = BatchGetJobInfo ( JobId , Level , NULL , 0 , &Need);

Buff = (LPBYTE)LocalAlloc(0,Need);

if (Buff ==NULL){

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

delete [] pTemp;

exit(0);

}

CbSize= Need;

ReturnVal = BatchGetJobInfo ( JobId , Level , Buff , CbSize , &Need);

switch(ReturnVal)

{

case BATCH_ERROR_NO_SUCH_JOB :

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

break;

case ERROR_INVALID_LEVEL :

cout << "The level parameter is not 1 or 2. " << endl;

break;

case BATCH_ERROR_BAD_JOB_NAME :

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

break;

default :

cout << "SUCCESSFUL IN GETTING THE JOB INFO"<< endl;

}

cout << " FINISHED THE EXECUTION OF BATCHGETJOBINFO API " << endl;

delete [] pTemp;

LocalFree(Buff);

}