Thursday, April 16, 2009

The JOB Statement - Tutorial 04

Q. What is the purpose of JOB Statement?
A. The JOB statement is used to identify the JOB to the MVS operating system.

- It tells the MVS OS about the start of a new job.
- It informs the MVS OS, the accounting information, so that the user can be billed for the computing time.
- It provides the name of the programmer to the MVS OS.
- It specifies the JOB's class(category) to the MVS OS, thus giving indication whether the Job requires more CPU time or less CPU time.
- More precisely, it also tells the MVS OS, what is the priority of the Job. So that the scheduler of the MVS OS - JES(Job Entry Subsystem) will enter the JOB in the system, before other jobs with lower priority.
- It tells the MVS OS, what is the output to be printed - whether to print JCL corresponding to the JOB statement only, or all the JCL statements. In addition, does it need to print allocation/termination messages.
- Moreover, it will announce to the MVS OS, which output device to print these output messages on.
- Sometimes, by writing a JCL parameter, you can instruct the MVS OS, to hold the job for later execution. You can also ask the MVS OS, to look for syntax errors in your JCL, before actually running the JOB.
//jobname   JOB    accounting-info,programmer-name,
//                 class,priority,
//                 message-class,message-level,
//                 hold|scan
Q. What is a valid jobname?
A job has to be given a name, by which the MVS OS will refer to it. The jobname can be 1-8 characters in length. The first character must alphabetic or national character. Subsequent letters can be alphabets, digits or national characters.

Valid jobnames

Invalid jobnames
Q. What is the accounting-information parameter?
Accounting information in an IBM-Mainframe system is used to bill/charge any job that is run on a Mainframe computer. You must tell the MVS OS, the account number to which to bill the CPU time utilized.

//JOB1  JOB  A123

Here A123 is the account number to  which the CPU time utilized on the Mainframe will be billed.


Here QUASAR is the additional accounting information. The leading comma indicates the absence of the positional parameter Account no.

//JOB1 JOB  (A123,'QUASAR S')
Q. What is the programmer-name parameter?
The programmer name parameter is used to identify the programmer is written the COBOL Program in the JOB being executed.


In the case that, the programmer name contains special characters, we must enclose it in single quotes.

//JOB1  JOB  A123,'QUASAR S'

Q. What are keyword parameters?
Keyword parameters are those, which can appear in any order. They are identified by writing the keyword. The following keyword parameters are important for the JOB statement.
Q. What is the CLASS parameter?
The CLASS parameter is used to categorize the job. For example, a CLASS=K might mean that all the jobs which use a lot of CPU time. Another CLASS=X might mean jobs with a lower priority.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A

Here, the job is categorized as Class=A. When installing the MVS OS, various defaults are established. Different letters and numbers are assigned to classes that tell the MVS the nature of the Job.
Q. What is the PRTY parameter?
The PRTY parameter is used to assign priority to Jobs. A job with priority 6 will always be run before a job with priority 3.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=6
//JOB2  JOB  B123,'REENA S',
//           CLASS=A,PRTY=9

Here, JOB2 will be run before JOB1.
Q. What is the MSGCLASS Parameter?
Messages can be of two types -
1. Messages related to the System and JCL
2. Output of the program or procedure being executed.

As the job runs, the MVS OS generates several system messages about the events that take place along the way. This includes messages related to the system, and those that have to do with JCL that is being executed. To add to this, the program or procedure being executed, takes some input -> performs processing on input data -> generates some output(Report).

The MSGCLASS parameter tells the MVS OS, which class of output devices should these output messages be stored. The output-devices are categorized into different classes while generating the system.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=6,
//           MSGCLASS=A

Here, all the output messages will be routed to the output device of class A; usually the system default printer/job spool.
Q.What is the MSGLEVEL Parameter?
As we discussed above, messages are broadly of 2 types. Let us discuss further at length, what are the messages that the system produces as a job runs.

- Log messages indicating JOB Name, Username, Password, are routed to the output device.
- Next, the JCL statements that make up the Job.
- Also, output of the program being executed.
- Messages related to the successful execution/termination(ABEND Code) will be output.
- At the start of the job and end of job, allocation/termination messages are produced.


0 : Only the JOB statement is output
1 : All JCL statements, including any cataloged procedures or symbolic parameters,
2 : Only Input JCL

0 : The allocation/termination messages are printed only if the job terminates abnormally.
1 : The allocation/termination messages are output irrespective of whether the job is successful or ABENDS.

//JOB1  JOB  A123,'QUASAR S',
//           CLASS=A,PRTY=1,
//           MSGCLASS=A,MSGLEVEL=(1,1)