struct jobInfoHead is returned by the lsb_openjobinfo_a() function. It is defined as follow:
struct jobInfoHead {int numJobs;LS_LONG_INT *jobIds;int numHosts; char **hostNames;int numClusters;char **clusterNames;int *numRemoteHosts;char ***remoteHosts;};
ld is the same struct as used in the above lsb_suspreason() function call.
This program is similar but different from the above program for displaying the suspending reason. Use lsb_openjobinfo_a() to open the job information connection, instead of lsb_openjobinfo(). Because the struct jobInfoHead is needed as one of the arguments when calling the function lsb_pendreason().
The following initialization and code fragment show how to display the pending reason using lsb_pendreason():
/* initialization */char *pendreason;struct loadIndexLog *indices =(struct loadIndexLog *) malloc(sizeof(struct loadIndexLog));struct jobInfoHead *jInfoH = (struct jobInfoHead *) malloc(sizeof(struct jobInfoHead));/* open the job information connection with mbatchd */jInfoH = lsb_openjobinfo_a(0, NULL, user, NULL, NULL, options);/* gets the total number of pending job, exits if failure */if (jInfoH==NULL) {lsb_perror("lsb_openjobinfo");exit(-1);}/* get the list of all load index names */indices->name = getindexlist(&indices->nIdx);/* get and print out the pending reasons */pendreason = lsb_pendreason(job->numReasons,job-> reasonTb,jInfoH,indices,clusterId);printf("%s\n",pendreason);