Pages

Wednesday, July 25, 2012

Building Jobstreams

So far you've learned about the primary JCL statements used in jobstreams and the proper syntax rules for coding JCL statements.

Many programmers feel overwhelmed at this point; there seem to be so many rules and parameters that they don't know where to start! However, learning to build a JCL jobstream isn't that difficult. In fact, it's fairly straightforward if you approach it step by step.

In this unit you'll learn the steps to get your JCL jobstream started. You'll design a system flow diagram and begin coding the basic statements that will make up your jobstream.

After completing this unit, you should be able to:

  • Describe the steps to take before you begin coding JCL

  • Create a system flow diagram

  • Outline an entire jobstream


Topic 4.1: Diagramming the System Flow

*Programs and Utilities
First, let's recall what a program is and define a utility.
A program is a set of instructions in a computer-readable language that control what a computer does, step by step.
A utility is a program that performs a commonly needed task, such as printing or copying data sets. Some come with the operating system and some can be bought from vendors.

*Step by Step
Printing a data set is exactly the problem you will solve. You'll
  • Select the program or utility to use

  • Define its requirements

  • Diagram the job requirements

  • Build the jobstream
Since choosing the program or utility is first on your list, let's choose one and see what comes next.

*Selecting a Utility
IBM supplies many utilities with their operating systems. One, in particular, is very easy to use and performs functions such as copying and printing data sets.
You will use this one for printing a data set. It is called IEBGENER. You can find complete information about it in the Utilities Reference Manual.
Don't get worried by the name. All IBM utilities start with unusual prefixes to distinguish them from programs written in-house.
Now that you've selected IEBGENER, the next step is to learn a few things about it before you write the JCL.

*Defining Requirements
Here's what you need to learn about IEBGENER:
  • Input/output files that it uses
  • ddnames that it expects
  • Control parameters that it needs to run
This table shows what IEBGENER needs to run.
Examine the following table
Data Sets
Files
ddname
Input SYSUT1
Output SYSUT2
Messages SYSPRINT
Parameters SYSIN


*Files and ddnames
Take a moment to understand how files and ddnames are associated.
When the program accesses a file, the program refers to the file by its file name. The file name that the program uses must be associated with the ddname of a DD statement following the EXEC statement in the JCL. Therefore, the ddname is the link or bond between the JCL and the program.
The DD statement specifies the exact location of the file, such as the tape number, the disk name or the specific printer.
In the example below, MASTER will be linked within PAY012 with the file name the program uses to access PAY.MASTER.
//STEP1  EXEC PGM=PAY012
//MASTER DD  DSN=PAY.MASTER,DISP=OLD

*Where ddnames Come From
ddnames are arbitrary names selected by the author of the program.
Usually, they must follow standards set by the installation. And you'll notice that all IBM utilities use similar ddnames for similar functions.
But, the important idea is that they are already defined.



*Reviewing the Requirements
Let's review the table of what IEBGENER needs to run.
Examine the following table
Data Sets
Files
ddname
Input SYSUT1
Output SYSUT2
Messages SYSPRINT
Parameters SYSIN

Now, let's get down to the business of coding the jobstream for the sample problem. Remember, you need to print a data set.
For your reference, the following question screens display this table showing the IEBGENER specifications.

*The System Flow Diagram
Now you can see what the job requires. From here you can start writing the JCL.

Topic 4.2: Outlining the Jobstream

*Coding the Stubs
The first step in actually coding JCL is to outline the entire jobstream.
Make an outline by coding stubs for each JCL statement:
  • The JOB and end-of-job statements
  • An EXEC statement for each step
  • DD statements for each input or output file
A stub is a skeleton or incomplete statement, omitting information to be filled in later. Here are sample stubs for the JOB, EXEC and DD statements.
//jobname   JOB
//stepname  EXEC
//ddname    DD

*Naming Rules
Before you can code these stubs, you must remember the rules for coding JOB, STEP and DD names:
  • The name field must start in position 3. There are no spaces between the // and the name.
  • The name field can be made up of 1-8 alphanumeric (A-Z, 0-9) and national (@ # $) characters.
  • The first character of the name field must be alphabetic or national.
  • The name field must be followed by at least one blank space.


*Step Names
The step name:
  • Is optional.

  • May be a mnemonic describing what the step is doing or what sequence it is in the job.

  • Should be coded since it is used many times for referencing, parameter substitutions, overriding information and restarting jobs.



*The Finished Outline
You now have stubs for all the JCL statements needed to run this job.
//PRINTIT  JOB
//STEP1    EXEC
//SYSUT1   DD
//SYSUT2   DD
//SYSPRINT DD
//SYSIN    DD
//
The next step is to fill in the necessary parameters, as you will see in the next unit.

Topic 4.3: Unit 4 Summary

In this unit you learned the initial steps for writing a simple jobstream:
  • Define the problem.

  • Determine the program or utility to use. The program needed may be one of the utilities provided with the operating system.

  • Review the program documentation to learn the requirements of the utility or program.

  • The file name that the program uses must be associated with the ddname of a DD statement following the EXEC statement in the JCL. Therefore, the ddname is the link or bond between the JCL and the program.

  • Before coding the jobstream, draw a system flow diagram to graphically represent what is happening. A program box, plus all input and output data sets, should be included in this diagram.

  • Outline the entire jobstream by coding stubs for each JCL statement, including the JOB and end-of-job statements, an EXEC statement for each step, and DD statements for each input or output file. A stub is a skeleton or incomplete statement, omitting information to be filled in later.

No comments:

Post a Comment