z/OS concepts
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Batch processing and JES: Scenario 1

z/OS concepts

Imagine that you are a z/OS® application programmer developing a program for non-skilled users. Your program is supposed to read a couple of files, write to another couple of files, and produce a printed report. This program will run as a batch job on z/OS.

What sorts of functions are needed in the operating system to fulfill the requirements of your program? And, how will your program access those functions?

First, you need a sort of special language to inform the operating system about your needs. On z/OS, this language is job control language (JCL). JCL provides the means for you to request resources and services from the operating system for a batch job.

Specifications and requests you might make for a batch job include the functions you need to compile and execute the program, and allocate storage for the program to use as it runs.

With JCL, you can specify the following:

  • Who you are (important for security reasons).
  • Which resources (programs, files, memory) and services are needed from the system to process your program. You might, for example, need to do the following:
    • Load the compiler code in memory.
    • Make accessible to the compiler your source code; that is, when the compiler asks for a read, your source statements are brought to the compiler memory.
    • Allocate some amount of memory to accommodate the compiler code, I/O buffers, and working areas.
    • Make accessible to the compiler an output disk data set to receive the object code, which is usually referred to as the object deck or simply OBJ.
    • Make accessible to the compiler a print file where it will tell you your eventual mistakes.
    • Conditionally, have z/OS load the newly created object deck into memory (but skip this step if the compilation failed).
    • Allocate some amount of memory for your program to use.
    • Make accessible to your program all the input and output files.
    • Make accessible to your program a printer for eventual messages.
In turn, you require the operating system to:
  • Convert JCL to control blocks that describe the required resources.
  • Allocate the required resources (programs, memory, files).
  • Schedule the execution on a timely basis; for example, your program only runs if the compilation succeeds.
  • Free the resources when the program is done.

The parts of z/OS that perform these tasks are the job entry subsystem (JES) and a batch initiator program.

Think of JES as the manager of the jobs waiting in a queue. It manages the priority of the set of jobs and their associated input data and output results. The initiator uses the statements on the JCL cards to specify the resources required of each individual job once it has been released (dispatched) by JES.

Your JCL as described is called a job, in this case formed by two sequential steps, the compilation and execution. The steps in a job are always executed sequentially. The job must be submitted to JES to be executed. To make your task easier, z/OS provides a set of procedures in a data set called SYS1.PROCLIB. A procedure is a set of JCL statements that are ready to be executed.

Figure 1 shows a JCL procedure that can compile, link-edit and execute a program. The first step identifies the COBOL compiler, as declared in //COBOL EXEC PGM=IGYCRCTL . The statement //SYSLIN DD describes the output of the compiler (the object deck).

The object deck is the input for the second step, which performs link-editing (through program IEWL). Link-editing is needed to resolve external references and bring in or link the previously developed common routines (a type of code re-use).

In the third step, the program is executed.

Figure 1. Procedure to compile, link-edit, and execute programs
000010 //IGYWCLG PROC LNGPRFX='IGY.V3R2M0',SYSLBLK=3200,
000020 //             LIBPRFX='CEE',GOPGM=GO
000030 //*
000040 //********************************************************************
000050 //*                                                                  *
000060 //*  Enterprise COBOL for z/OS and OS/390                            *
000070 //*               Version 3 Release 2 Modification 0                 *
000080 //*                                                                  *
000090 //*  LICENSED MATERIALS - PROPERTY OF IBM.                           *
000100 //*                                                                  *
000110 //*  5655-G53 5648-A25 (C) COPYRIGHT IBM CORP. 1991, 2002            *
000120 //*  ALL RIGHTS RESERVED                                             *
000130 //*                                                                  *
000140 //*  US GOVERNMENT USERS RESTRICTED RIGHTS - USE,                    *
000150 //*  DUPLICATION OR DISCLOSURE RESTRICTED BY GSA                     *
000160 //*  ADP SCHEDULE CONTRACT WITH IBM CORP.                            *
000170 //*                                                                  *
000180 //********************************************************************
000190 //*
000300 //COBOL  EXEC PGM=IGYCRCTL,REGION=2048K
000310 //STEPLIB  DD  DSNAME=&LNGPRFX..SIGYCOMP,
000320 //             DISP=SHR
000330 //SYSPRINT DD  SYSOUT=*
000340 //SYSLIN   DD  DSNAME=&&LOADSET,UNIT=SYSDA,
000350 //             DISP=(MOD,PASS),SPACE=(TRK,(3,3)),
000360 //             DCB=(BLKSIZE=&SYSLBLK)
000370 //SYSUT1   DD  UNIT=SYSDA,SPACE=(CYL,(1,1))
000440 //LKED   EXEC PGM=HEWL,COND=(8,LT,COBOL),REGION=1024K
000450 //SYSLIB   DD  DSNAME=&LIBPRFX..SCEELKED,
000460 //             DISP=SHR
000470 //SYSPRINT DD  SYSOUT=*
000480 //SYSLIN   DD  DSNAME=&&LOADSET,DISP=(OLD,DELETE)
000490 //         DD  DDNAME=SYSIN
000500 //SYSLMOD  DD  DSNAME=&&GOSET(&GOPGM),SPACE=(TRK,(10,10,1)),
000510 //             UNIT=SYSDA,DISP=(MOD,PASS)
000520 //SYSUT1   DD  UNIT=SYSDA,SPACE=(TRK,(10,10))
000530 //GO     EXEC  PGM=*.LKED.SYSLMOD,COND=((8,LT,COBOL),(4,LT,LKED)),
000540 //             REGION=2048K
000550 //STEPLIB  DD  DSNAME=&LIBPRFX..SCEERUN,
000560 //             DISP=SHR
000570 //SYSPRINT DD  SYSOUT=*
000580 //CEEDUMP  DD  SYSOUT=*
000590 //SYSUDUMP DD  SYSOUT=*

To invoke a procedure, you can write some simple JCL, as shown in Figure 2. In this example, we added other DD statements, such as//COBOL.SYSIN DD *, which identifies the data set that contains the COBOL source code.

Figure 2. Procedure to compile, link-edit, and execute a COBOL program
000001 //COBOL1 JOB (POK,999),MGELINSKI,MSGLEVEL=(1,1),MSGCLASS=X,
000002 //  CLASS=A,NOTIFY=&SYSUID
000003 /*JOBPARM SYSAFF=*
000004 // JCLLIB   ORDER=(IGY.SIGYPROC)
000005 //*
000006 //RUNIVP EXEC IGYWCLG,PARM.COBOL=RENT,REGION=1400K,
000007 //             PARM.LKED='LIST,XREF,LET,MAP'
000008 //COBOL.STEPLIB DD DSN=IGY.SIGYCOMP,
000009 //             DISP=SHR
000010 //COBOL.SYSIN DD *
000011        IDENTIFICATION DIVISION.
000012        PROGRAM-ID.    CALLIVP1.
000013        AUTHOR.        STUDENT PROGRAMMER.
000014        INSTALLATION.  MY UNIVERSITY
000015        DATE-WRITTEN.  JUL 27, 2004.
000016        DATE-COMPILED.
000017        /
000018        ENVIRONMENT DIVISION.
000019        CONFIGURATION SECTION.
000020        SOURCE-COMPUTER.  IBM-390.
000021        OBJECT-COMPUTER.  IBM-390.
000022
000023        PROCEDURE DIVISION.
000024            DISPLAY "***** HELLO WORLD *****" UPON CONSOLE.
000025            STOP RUN.
000026
000027 //GO.SYSOUT DD SYSOUT=*
000028 //

During the execution of a step, the program is controlled by z/OS, not by JES (Figure 3). Also, a spooling function is needed at this point in the process.

Figure 3. Related actions with JCL
Spooling is the means by which the system manipulates its work, including:
  • Using storage on direct access storage devices (DASDs) as buffer storage to reduce processing delays when transferring data between peripheral equipment and a program to be run.
  • Reading and writing input and output streams on an intermediate device for later processing or output.
  • Performing an operation such as printing while the computer is busy with other work.

There are two sorts of spooling: Input and output. Both improve the performance of the program reading the input and writing the output.

To implement input spooling in JCL, you declare // DD *, which defines one file whose content records are in JCL between the // DD * statement and the /* statements. All the logical records must have 80 characters. In this case, this file is read and stored in a specific JES2 spool area (a huge JES file on disk) as shown in Figure 4.

Figure 4. Spooling

Later, when the program is executed and asks to read this data, JES2 picks up the records in the spool and delivers them to the program (at disk speed).

To implement output spooling in JCL, you specify the keyword SYSOUT on the DD statement. SYSOUT defines an empty file in the spool, allocated with logical records of 132 characters in a printed format (EBCDIC/ASCII/UNICODE). This file is allocated by JES when interpreting a DD card with the SYSOUT keyword, and used later for the step program. Generally, after the end of the job, this file is printed by a JES function.





Copyright IBM Corporation 1990, 2010