NetBatch Management Programming Manual

Sample Programs
NetBatch Management Programming Manual522462-003
C-2
Sample C Program
Sample C Program
Example C-1 on page C-4 contains the source code for a sample C program. The
program submits a job to a scheduler, executes a STATUS JOB command on the
submitted job, and displays some job details. The source code for the program is
available in the file NBSPIEX in the NetBatch installation subvolume.
The prerequisite to completing the procedure is a D21 or later scheduler named $ZBAT
running on the node where the program will run.
Step 1: Copy the Source Code
Copy the source code for the sample C program from file NBSPIEX to a new EDIT file:
> EDIT; GET $SYSGEN.ZNETBTCH.NBSPIEX 7/537 PUT TEMP.CSRC
TEXT EDITOR - T9601D20 - (01JUN93)
CURRENT FILE IS $DATA7.TEMP.CSRC
Step 2: Change ISV.ZSPIDEF References
Change ISV.ZSPIDEF references in the new file to specify the volume and subvolume
containing the source-definition files ZSPIC and ZBATC:
*LIST BOTH /ISV.ZSPIDEF/
39 #include "$ISV.ZSPIDEF.ZSPIC" nolist
40 #include "$ISV.ZSPIDEF.ZBATC" nolist
*CHANGE /ISV/SYSGEN/ ALL
39 #include "$SYSGEN.ZSPIDEF.ZSPIC" nolist
40 #include "$SYSGEN.ZSPIDEF.ZBATC" nolist
Step 3: Change Class Name
Change class name CLASS-A to that of an existing class in $ZBAT if class CLASS-A
does not exist in that scheduler. Otherwise, add class CLASS-A to $ZBAT.
*CHANGE /"CLASS-A "/"OPERATIONS
"/ ALL
329 cptr = strncpy (JOB.zclassname.u_z_c.z_c,
"OPERATIONS ",24);
Step 4: Change Job Name
Change job name MASTER-A to your own choice of name if MASTER-A conflicts with
an existing production job in $ZBAT. Otherwise, delete job MASTER-A from $ZBAT.
*CHANGE /"MASTER-A "/"C-JOB
"/ ALL
242 cptr = strncpy (jobname.u_z_c.z_c,
"C-JOB ",24);