External job message and data exchange

lsb_postjobmsg() sends an external message/status to a job. It can also transfer an attached data file through a TCP connection. The posted messages and attached data files can be read from mbatchd by invoking lsb_readjobmsg().

int lsb_postjobmsg(jobExternalMsgReq, fileName) 
struct jobExternalMsgReq *jobExternalMsgReq; 
    char *fileName;           Data file to be attached
int lsb_readjobmsg(jobExternalMsgReq, jobExternalMsgReply)  
struct jobExternalMsgReq *jobExternalMsgReq; 
struct jobExternalMsgReply *jobExternalMsgReply;

Use struct jobExternalMsgReq as a parameter in both lsb_postjobmsg() and lsb_readjobmsg(). It contains all the details on the external message or status to be read or posted.

struct jobExternalMsgReq { 
    int         options;    Indicated which operation to be performed 
#define EXT_MSG_POST 0x01   Post external message 
#define EXT_ATTA_POST 0x02  Post external data file 
#define EXT_MSG_READ 0x04   Read external message 
#define EXT_ATTA_READ 0x08  Read external data file 
#define EXT_MSG_REPLAY 0x10 Replay external message 
    LS_LONG_INT jobId;      Message of the job to be posted/read 
    char        *jobName;   Name of the job if jobId is undefined (<=0) 
    int         msgIdx;     Index in the list 
    char        *desc;      Text description of the message 
    int         userId;     Author of the message 
    long        dataSize;   Size of the data file 
    time_t      postTime;   Message sending time 
};

The struct jobExternalMsgReply holds information on external message/status requested by the user. It is defined in lsbatch.h as follows:

struct jobExternalMsgReply { 
    LS_LONG_INT jobId;       Message of the job to be read 
    int         msgIdx;      Index in the message list 
    char        *desc;       Text description of the message 
    int         userId;      Author of the message 
    long        dataSize;    Size of the data file 
    time_t      postTime;    Message sending time 
    int         dataStatus;  Status of the attached data 
#define EXT_DATA_UNKNOWN 0   Data transferring of the message is processing 
#define EXT_DATA_NOEXIST 1   Message without data attached 
#define EXT_DATA_AVAIL 2     Data of the message is available 
#define EXT_DATA_UNAVAIL 3   Data of the message is corrupt 
};