JCL statements – JOB statement

 

The JOB statement is the very first control statement in a JCL. It marks the start of a job and also specifies the name of the job. The JOB statement is also used to provide certain administrative information, including accounting, security and identification information.

There will be only 1 JOB statement in a given job.

JOB Statement Syntax

1

JOB Name

As said earlier, JOB statement marks the beginning of every job and gives a name to the job. Here in above example, the JOB name is ‘SAMPLE01’.

The JOB name is –

  • Mandatory and will always start at column 3.
  • The Job name is 1 to 8 bytes in length, which can be alphabetic, alphanumeric or national (#, @, $).
  • First byte of Job name can be either alphabetic or national. It cannot be numeric.
  • Job name must be followed by at least 1 blank.

The JOB name gives an identity of the job to the MVS, in the spool and in the scheduler.

Once you submit a job, you can check the execution details of the job in spool using the jobname.

(Spool navigation: START -> S -> ST -> PRE <space> jobname). (Assumption here is that the site has SDSF to manage the spool. These options might vary for different shops.)

You might be wondering, in case, same job with same jobname or some another job with same jobname is submitted multiple times, then how will you identify your submitted job details in spool?

Please remember, when you submit a job, a unique number called as job-number is assigned to it by the JES (Job entry subsystem), details of which are generally displayed when job is submitted.

Using the Job-name and Job-number combination, you can uniquely identify the log of the job submitted in spool. However, if you’ve SUBmitted a JOB twice with same name, then the “second Job” will be queued up and wait until the first Job with same name finishes.

JOB Keyword

The literal JOB is used to identify that it is a JOB statement or a JOB card. This is the only keyword to identify a Job-card.

Positional Parameters

In JOB statement, there are 2 Positional parameters:

(a)  Accounting Information

This information is used to identify the person or the department or the organization that will be charged for utilizing the CPU time on mainframe.

It should be coded between enclosing parentheses ( ) or apostrophes ‘’.

For example (6621, GROUP2) or ‘6621, GROUP2’. Here we can say, GROUP2 is a group in a given company and the 6621 is the department name in that group.

If any special characters are used, enclose the accounting information in apostrophes ‘’.

For example (6621,’GROUP/2’, 1) or ‘6621, GROUP/2,1’

Length: 1 to 143 bytes

Syntax: account-number

              ‘Account-number, other-info’

              ‘Account number’ (for special characters)

Accounting information is mandatory in JOB card and its value may differ across different mainframe shops.

(b)  Programmer Name

This identifies the person or the group that is responsible for the job. It is not a mandatory parameter.

If special characters (other than hyphens, leading or embedded periods) are coded, then the name must be enclosed in apostrophes ‘’.

Programmer name should be coded after accounting information.

Length: 1 to 20 bytes

Syntax: Name

               ‘Name’ (for special characters)

Key-points for Positional parameters

If a positional parameter is omitted, then a comma ‘,’ has to be coded to indicate the omitted parameter.

The replacing comma should not be coded in below scenarios:

  • If the positional parameter omitted is the last positional parameter.
  • If all the positional parameters are omitted.
  • If all the following positional parameters are omitted.

Keyword Parameters

The parameters apart from Positional parameters are called Keyword parameters.

These keyword parameters can be coded in any sequence following Positional parameters.

The Keyword parameters are indicated by coding the keyword sign followed by an equal ‘=’ sign and the keyword value. (Keyword = Value). E.g. CLASS = A.

Unlike Positional parameters, commas ‘,’ are not used to indicate omission of keyword parameters.

There are more than 20 keyword parameters and we will go through the common ones in detail.

(a)  CLASS

In order to improve the efficiency of a batch system, one way is to carefully schedule the work by grouping the jobs with similar resource requirements and this task of grouping similar jobs is done by assigning them to classes.

For e.g., a Class A job might need only the standard input and output devices, while the jobs requiring for a printer output might be assigned to Class B.

In simple terms, CLASS keyword specifies the job class i.e. the nature of the job.

Many mainframe shops do not make use of this option and the CLASS value is set as per the assigned User id.

Job CLASSES are set up at JES initialization.

Length: 01 Byte

Possible Values: A to Z or 0 to 9.

Syntax: CLASS = value

As mentioned earlier, keyword parameters are optional, so if you do not specify CLASS keyword in the job card, JES will use the installation default specified at initialization.

Example

class
(Source: IBM)

Here, in above example, we can see that the 2 jobs T1 and T2 have been submitted and they are in spool queue. Considering CLASS=A having high priority than CLASS=W, T1 job will be executed first.

Please note that the class priority may vary in every mainframe shop. It varies depending on the parameters setup during install.

(b)  MSGCLASS

While working with JCL, you need to see the execution details or the ‘job log’ of the JCL submitted. These job logs require memory destination in order to be stored or written.

MSGCLASS does this task of determining the output class where the system messages and JCL messages will be written.

Length: 01 Byte

Possible Values: A to Z or 0 to 9.

Syntax: MSGCLASS = value

As mentioned earlier, keyword parameters are optional, so if you do not specify MSGCLASS keyword in the job card, JES will use the installation default specified at initialization.

Example

msgclass
(Source: IBM)

(c)   MSGLEVEL

MSGLEVEL keyword specifies which JCL statement and JES messages are to be printed in the job log.

Syntax: MSGLEVEL=(x,y)

The first sub-parameter of MSGLEVEL controls which statements will be printed in the job log.

The second sub-parameter of MSGLEVEL controls which messages will be printed in the job log.

Below illustration will clear the MSGLEVEL usage clearly.

meglevelAs mentioned earlier, keyword parameters are optional, so if you do not specify MSGLEVEL keyword in the job card, JES will use the installation default specified at initialization.

Did you notice that parentheses ‘()’ were included in above syntax. Also, did you wonder why so?

Before answering to this, first check how many sub-parameters were coded?

2 – Correct. So, when there are more than 1 sub parameter being coded, you must make use of parentheses ‘()’.

(d)  Notify

NOTIFY keyword helps the system determine where to send the job complete information.

It causes the system to notify the TSO user mentioned on the NOTIFY parameter when the job completes.

Syntax: NOTIFY = user-id        – Message will be sent to mentioned user-id. Must be a valid

TSO ID.

                 NOTIFY = &SYSUID  – Messages will be sent to the user-id that was used to submit

the job.

(e)  TYPRUN

TYPRUN keyword modifies the way JES processes the JOB.

It checks the JCL and holds the job in the input queue.

  • TYPRUN=SCAN

JCL is scanned for errors but is not executed.

  • TYPRUN=HOLD

JCL is scanned for errors and if there are any errors, the JCL fails with error notification without execution.

If there are no errors, the job is held in queue and it should be released by the user for execution.

Release action can be done by typing ‘A’ against the job name in spool.

  • TYPRUN= JCLHOLD

It is similar to HOLD, however, the error check is done only after the job is released by the user.

(f)    REGION

When you submit a JCL, it needs some memory where it can process and execute the required task.

The REGION parameter specifies the amount of virtual storage needed by a job/ job step.

It can be coded in JOB statement and EXEC statement as well.

Please note,

  • If REGION is specified in JOB statement, it applies to each step in the job and overrides the REGION parameter specified in each EXEC statement.
  • Jobs will abend if some step needs a larger REGION size or if the REGION value cannot be obtained.
  • REGION must be defined in Steps, when different steps need different amount of space.

REGION can be specified with the value equal to K (kilobytes) or M (Megabytes)

Syntax:  REGION= xx K/M

A value equal to 0K or 0M will give job all the storage available.

 (g)  RESTART

While working on the data processing, you will definitely face errors. This is a fact and let us accept it.

No worries mate! RESTART parameter will help you instruct the system to restart your job after a failure. Of course, the restart action might or might not be successful. It totally depends on what kind of error you have encountered.

RESTART parameter forces the JOB execution to start from the mentioned step.

Syntax: RESTART=step-name

Example

restart
(Source: IBM)

Please note, in order to make use of the RESTART option, step names must be unique.

(h)  TIME

time1

time 2

Most batch systems automatically cancel a program caught in an endless loop after a reasonable time has passed.

The data for setting the timer must come from somewhere.

This task is done by using the TIME parameter.

TIME parameter signifies the maximum time that the JOB or STEP can take to run.

It can be coded in both JOB & EXEC statements.

If it is coded in both JOB and EXEC statements, the smaller among them will be applicable.

Syntax: TIME=NOLIMIT     – JOB can utilize the processor for any amount time.

                TIME = MAXIMUM  – JOB or STEP can be used for maximum amount of time                                                              i.e. 357,912 minutes.

               TIME = (minutes, seconds)  

Please note that TIME=1440 is equivalent to coding TIME=NOLIMIT. Thus, 1440 is the only numerical value that is not to be interpreted directly.

When there is a time out, the abend code is S322.

(i)    PRTY

It assigns priority to jobs.

Consider that there are 2 jobs in a queue with same job class, JES will schedule the job that has high priority first.

Priority numbers range from (0-14) or (0-15) depending on the installations.

The job with priority coded as 15 has the highest priority and PRTY = 0 has the lowest priority.

Syntax: PRTY=priority

Defaults in JCL

In above discussion, we have repeatedly mentioned the default values that would be considered in case you don’t mention.

Did it strike to you why it is so?

Okay, so there are many parameters that can be coded by you programmers in each of the jobs. Instead of coding these parameters, mainframe shops rely on the Defaults.

So, if you fail to mention any keyword and its corresponding value, the system will assume a value by default. However, mostly accounting information and programmer name is required. But, again it will entirely depend on how the JCL in the mainframe shop has been configured. In few shops, it might happen that it will be okay if you don’t provide the accounting information and the programmer name values as well.

To override a default, simply code the appropriate parameter.

This was all about the JOB statements in a JCL.

We will continue with the EXEC statement in the next discussion.

 

dyk2