Initially, when the computers were new to the world, the size of the computers was huge and very clumsy to use. Also, initially there were no display terminals. So, there were switches on the front panel of the computers to indicate the task to be performed. Computers understand only 0s and 1s. So, if the switch was ON, it indicated 1s and if the switch was OFF, it indicated 0s.
Why JCL was invented?
Research and Development was taking place, different languages were introduced. COBOL was one of them.
At the same time punch cards were invented. These punch cards were basically cardboard cards with 80 columns. Each card represented 1 line on a sheet of paper. Each column on the card had enough space for multiple holes to be punched in it.
When a hole was punched, it represented 1, which was similar to a switch in ON position. And an unpunched hole represented 0 – similar to switch in OFF position.
Logic was coded in such a manner that the combination of holes and non-holes at any column of the punch card represented a letter, or digit, or any symbol.
Along with the punch cards, punch machines were introduced. These punch machines had type writer keyboards which would punch holes into the punch cards for every key pressed. So, if the user typed the letter A, then the machine punched holes for the code for A. Then move on to next column, type in next character, then next character and so on…
Punch cards and machines were used by scientists and engineers for writing program logic and read the same in computer.
You might be thinking how computers understood in which computer language the program was written? Also, if any data was to be used from the disk or a tape for program execution, how did computer understand?
Things were getting complicated, ideas were flowing in, and then the scientists decided that there should be 1 program running all the time which would basically read the cards and decide what to do with them. Sounds like a master control? Yeah, you got it right. However, things were complex as there were too many tasks to look after. So, they came up with a set of programs, which would eventually operate the computer. These set of programs were called as a “System”.
And this is how Operating System (OS) developed. With time, there were enhancements, and MVS was introduced.
Coming back, the System or OS read the cards and identified in which programming language it was written. Sometimes, it would store the programs for later use or execute a previously saved program.
So, eventually the OS stored all the programs in libraries on disk. Punch cards were used to carry out a specified task as and when required. These were nothing but the JOBs which were then replaced and controlled by a new language called Job Control Language or JCL.
This is how JCL was invented!
Let’s discuss more about JCL….
What is JCL (Job Control Language)?
While working in Mainframe environment, we need to instruct the system to execute some task or a series of tasks in sequence. This is done using a JCL.
A JCL will instruct the system (z/OS) from where to get the input, which program(s) or utilities will use that input, and what to do with the resulting output.
So, the question will arise, where should I or where will I make use of a JCL?
As a Mainframe developer, you’d use JCL in many ways, for instance –
You being a developer, have coded/written a COBOL code. How will you compile that COBOL code? Or how will you execute that COBOL code?
For this, we will have to use a Compile JCL which will compile a COBOL code and then execute the same.
(Please note that a compile JCL can be used to compile both batch and online programs. However, only batch programs are executed thru JCL).
This is just 1 example. There will be different instances where you have a file and you need to check whether that file is empty or not, that can be done using JCL.
Below are the different instances where a JCL can be used:
- Create and deleting data-sets.
- Define/alter GDG.
- Sorting records in a given file.
- Passing data to a program.
- Send data from one system to another…. And many more!!
While working on Mainframe, a JCL and a JOB can be used interchangeably – however, which is correct, is a debatable topic.
A ‘JOB’ is a ‘JCL’ with a ‘Job-Card’; a ‘PROC’ is a ‘JCL’ without a ‘Job-Card’. So, you might see these terms being used as synonyms but you know the difference now!
So, loosely, it is okay if you say ‘I’ve submitted a job’, which is same as saying ‘I’ve submitted a JCL’.
But, someone just might argue on this, and hopefully, you’ve a reason to understand such an argument now.
We hope this tells you what a JCL in mainframe basically is.
Now, what does a JCL basically contain?
JCL “simulates” a task on mainframe in the form of control statements which are 80-bytes long.
Each statement is divided into 5 fields. This is as shown in below picture which illustrates the JCL coding sheet.
- It starts from column 1 and the length is 2 bytes.
- 2 slashes // indicate that it is a JCL statement.
- //* indicates that it is a comment statement.
- /* indicates the end of an instream data.
- If JCL statement begins with 2 slashes // followed by nothing but spaces, then it indicates that it is a null indicator and it will be considered as an end of the job. So, if there are any statements below null indicator, then it won’t be considered for execution.
Name Field (Optional)
- It starts from column 3 and the length is 8 bytes.
- Name field can be alphanumeric. However, the first byte can be either a character or national character (#,@,$).
- Name field must be followed by at least 1 blank.
- It starts from column 11 and the length is 5 bytes.
- If the Name field is blank, then Operation field can begin at 4th column itself.
- It follows the Name field and there should be at least 1 blank space between the Name and the Operation field.
- Keywords: JOB, EXEC, DD.
- It starts from column 16 and the length is 57 bytes.
- It basically contains the parameters needed for the operation.
- It follows the Operation field and there should be at least 1 blank space between the Operation and the Operand field.
- If the operands are more, then they can be continued in the next line. This can be done by ending current JCL statement with a comma before column 72 and start the next line anywhere between 4 and 16.
- There are 2 types: Positional and keyword.
Comment Field (Optional)
- It follows Operand field and there should be at least 1 space between the operand and the comment field.
- This is a bit difficult to use and so it is recommended to make use of Comment statement (//*).
Basic JCL codification rules:
- JCL statements start from column 1 and are identified by 2 slashes // at the beginning.
- JCL statements should be coded from column 1 to column 71.
- A comma indicates that the JCL statement has a continuation.
- If there is continuation, then it should start between columns 4 and 16.
- // and the rest of the statement with blanks will indicate the end of the job.
This explains the coding structure for JCL and you are now good enough to continue with the different type of JCL statements which we will cover up in the next discussion.
There are 3 main types of control statements in a job:
- 1 job card, which basically indicates the start of a job.
- 1 or more EXEC statements, depending on the number of steps within the job.
- 1 or more DD statements to identify input and output datasets.
We will discuss about the 3 control statements in the next session.
Why JCL statements are only 80-bytes in length?
In old mainframe systems, punch cards were used as inputs and since these cards had only 80 characters per record, JCL has restricted the control statements length to 80-bytes.