You can use the Change Job (QWTCHGJB) API to set the server job type
for a server that is configured in iSeries Navigator. After you have configured
the application's jobs to appear as server jobs, you can monitor the application's
server jobs in iSeries Navigator.
The
following is an example in C code of how to name the server job using the
QWTCHGJB API. The program that is used for the server or client application
needs to run as a job. You can define the server or client application as
a job with the Submit Job (SBMJOB) command.
/* Change job API - server type */
#include <qusec.h>
#include <QWTCHGJB.h>
typedef struct jobChangeInfo
{
Qus_Job_Change_Information_t fieldNum;
Qus_JOBC0100_t format;
char data[31];
} jobChangeInfo_t;
int main (int argc, char *argv[])
{
Qus_EC_t EcStruc;
Qus_EC_t* PtrEcStruc; /* iSeries structure for API errors. */
jobChangeInfo_t chg = /* Job change information for QWTCHGJB */
{
1, /* Number of variable length records. */
46, /* Length of attribute information */
1911, /* Key - Server Type. */
'C', /* Type of Data - Character. */
0X40,0X40,0X40, /* Reserved */
30, /* Length of data with server name. */
"YOUR_UNIQUE_SERVER_NAME "};
PtrEcStruc = &EcStruc; /* API error code structure. */
PtrEcStruc->Bytes_Provided = 16; /* Initalize bytes provided. */
PtrEcStruc->Bytes_Available = 0;
/*-------------------------------------------------------------------*/
/* API used for defining a server name in the job. */
/*-------------------------------------------------------------------*/
Note: The string in the second line of the following example is
padded with blanks to the full 30 characters.
QWTCHGJB("* ",
" ",
"JOBC0200",
&chg,
PtrEcStruc);
if ( PtrEcStruc.Bytes_Available != 0 ) {
printf("Error changing job server name. Application ended.");
printf("Error message id %s sent from QWTCHGJB API.",PtrEcStruc.Exception_ID);
exit(-1);
}
return 0;
}