NetBatch Management Programming Manual
NetBatch Procedure Calls
NetBatch Management Programming Manual—522462-003
7-18
Sample COBOL Program
Sample COBOL Program
Example 7-2 on page 7-20 contains the source code for a sample COBOL program
that demonstrates the use of NB^JOB^SUBMIT. The program uses NB^JOB^SUBMIT
to submit a job to a scheduler, displays some of the job’s details, and handles error
conditions. The source code for the program is available in the file NBSPIEX in the
NetBatch installation subvolume.
To run the sample program, you need 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 COBOL program from file NBSPIEX to a new
EDIT file:
> EDIT; GET $SYSGEN.ZNETBTCH.NBSPIEX 2129/2395 PUT
TEMP.NBCOBSRC
TEXT EDITOR - T9601D20 - (01JUN93)
CURRENT FILE IS $DATA7.TEMP.NBCOBSRC
Step 2: Change SYSTEM.SYSTEM References
Change SYSTEM.SYSTEM references in the new file to specify the volume and
subvolume containing the NetBatch library file BATCHLIB and the COBOL library and
external-declaration files COBOLLIB and COBOLEX0:
*LIST BOTH /SYSTEM.SYSTEM.BAT/
2131 ?SEARCH $SYSTEM.SYSTEM.BATCHLIB
*CHANGE /SYSTEM.SYSTEM.BAT/SYSTEM.SYS00.BAT/ ALL
2131 ?SEARCH $SYSTEM.SYS00.BATCHLIB
*LIST BOTH /SYSTEM.SYSTEM.COB/
2130 ?SEARCH $SYSTEM.SYSTEM.COBOLLIB
2132 ?CONSULT $SYSTEM.SYSTEM.COBOLEX0
*CHANGE /SYSTEM.SYSTEM.COB/SYSTEM.SYS00.COB/ ALL
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
2294 MOVE "OPERATIONS" TO JCLASS.
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/NBJS-COBOL85-JOB/ ALL
2285 MOVE "NBJS-COBOL85-JOB" TO ACTUAL-JOB-NAME.