lsb_readjobinfo()

lsb_readjobinfo() takes one argument:

int   *more;                 If not NULL, contains the remaining number of
                             jobs unread

Either this parameter or the return value from the lsb_openjobinfo() can be used to keep track of the number of job records that can be returned from the connection. This parameter is updated each time lsb_readjobinfo() is called.

jobInfoEnt structure

The jobInfoEnt structure returned by lsb_readjobinfo() is defined in lsbatch.h as:

struct jobInfoEnt {
    LS_LONG_INT  jobId;             job ID
    char         *user;             submission user
    int          status;            job status
    /* possible values for the status field */
#define JOB_STAT_PEND      0x01    job is pending
#define JOB_STAT_PSUSP     0x02    job is held
#define JOB_STAT_RUN       0x04    job is running
#define JOB_STAT_SSUSP     0x08    job is suspended by LSF batch system
#define JOB_STAT_USUSP     0x10    job is suspended by user
#define JOB_STAT_EXIT      0x20    job exited
#define JOB_STAT_DONE      0x40    job is completed successfully
#define JOB_STAT_PDONE     0x80    post job process done successfully
#define JOB_STAT_PERROR    0x100   post job process error
#define JOB_STAT_WAIT      0x200   chunk job waiting its execution turn
#define JOB_STAT_UNKWN     0x1000  unknown status
    int    *reasonTb;         pending or suspending reasons
    int    numReasons;        length of reasonTb vector
    int    reasons;           reserved for future use
    int    subreasons;        reserved for future use
    int    jobPid;            process Id of the job
    time_t submitTime;        time when the job is submitted 
    time_t reserveTime;       time when job slots are reserved 
    time_t startTime;         time when job is actually started
    time_t predictedStartTime;  job's predicted start time
    time_t endTime;           time when the job finishes
    time_t lastEvent;         last time event
    time_t nextEvent;         next time event
    int    duration;          duration time (minutes)
    float  cpuTime;           CPU time consumed by the job
    int    umask;             file mode creation mask for the job
    char   *cwd;              current working directory where job is
                                  submitted
    char   *subHomeDir;       submitting user’s home directory
    char   *fromHost;         host from which the job is submitted
    char   **exHosts;         host(s) on which the job executes
    int    numExHosts;        number of execution hosts
    float  cpuFactor;         CPU factor of the first execution host
    int    nIdx;              number of load indices in the loadSched and 
                              loadStop vector
    float  *loadSched;        stop scheduling new jobs if this threshold is
                              exceeded
    float  *loadStop;         stop jobs if this threshold is exceeded
    struct submit submit;     job submission parameters
    int    exitStatus;        exit status
    int    execUid;           user ID under which the job is running
    char   *execHome;         home directory of the user denoted by
                                  execUid
    char   *execCwd;          current working directory where job is
                                  running
    char   *execUsername;     user name corresponds to execUid
    time_t jRusageUpdateTime; last time job's resource usage is updated
    struct jRusage runRusage; last updated job's resource usage
    int   jType;              job type
    /* Possible values for the jType field */
#define    JGRP_NODE_JOB        1  this structure stores a normal batch job
#define    JGRP_NODE_GROUP      2  this structure stores a job group
#define    JGRP_NODE_ARRAY      3  this structure stores a job array
    char  *parentGroup;       for job group use
    char  *jName;              if jType is JGRP_NODE_GROUP, then it is
                              job group name. Otherwise, it is the job's
                              name
    int   counter[NUM_JGRP_COUNTERS];
    /* index into the counter array, only used for job array */
#define     JGRP_COUNT_NJOBS   0   total jobs in the array
#define     JGRP_COUNT_PEND    1   number of pending jobs in the array
#define     JGRP_COUNT_NPSUSP  2   number of held jobs in the array
#define     JGRP_COUNT_NRUN    3   number of running jobs in the array
#define     JGRP_COUNT_NSSUSP  4   number of jobs suspended by the
                                   system in the array
#define     JGRP_COUNT_NUSUSP  5   number of jobs suspended by the
                                   user in the array
#define     JGRP_COUNT_NEXIT   6   number of exited jobs in the array
#define     JGRP_COUNT_NDONE   7   number of successfully completed jobs
    int     counter[NUM_JGRP_COUNTERS]; 
    u_short port;             service port of the job
    int    jobPriority;       job dynamic priority
    int    numExternalMsg;    number of external messages in the job
    struct jobExternalMsgReply **externalMsg;
    int     clusterId;
    char   *detailReason;     Detail reason field
    float   idleFactor;
    int     exceptMask;       Job exception mask
    char   *additionalInfo;   Arbitrary job information string
                             currently used by rms_rid and rms_alloc
    int     exitInfo;         Termination reason
    int    warningTimePeriod;  Warning time in seconds, -1 if 
                               unspecified
    char   *warningAction;     Warning action, SIGNAL | CHKPNT |
                               command, NULL if unspecified
    char   *chargedSAAP;       SAAP charged for job
    char   *execRusage;        The rusage satisfied at job runtime
    time_t rsvInActive;          Time when AR was expired or deleted
    int    numLicense;            Number of licenses reported from LS
    char   **licenseNames;     LS license names
    float  aps;                Absolute priority value
    float  adminAps;           Static aps value set by admin
    int    runTime;            Job's real runtime
    int reserveCnt;  Number of resource types reserved by this job
    struct reserveItem *items;  Detail reservation information for
                                each kind of resource
    float  adminFactorVal;      Admin factor value
    int    resizeMin;   Pending resize min. 0, if no resize pending
    int    resizeMax;   Pending resize max. 0, if no resize pending
    time_t resizeReqTime;       Time when pending request was issued
    int    jStartNumExHosts;    Number of hosts when job starts
    char   **jStartExHosts;     Host list when job starts
   time_t lastResizeTime;       Last time job allocation changed
};

jobInfoEnt can store a job array as well as a non-array batch job, depending on the value of jType field, which can be either JGRP_NODE_JOB or JGRP_NODE_ARRAY.