The mainframe ecosystem consists of computers having different combinations of processors and memory and act as workstations and terminals for processing jobs and performing required operations. The first mainframe computer was developed in the 1930s and was made ready to use in 1943. It weighed about 5 tonnes and filled an entire room and cost about $200K. IBM began developing smaller, Linux-based systems starting in 1998. Nowadays, Mainframe computers are known to be powerful, agile and are no less than the size of refrigerators. They are mostly used for data processing and data analysis that is capable of processing trillions of instructions per second. Due to the powerful processing capabilities, the need for mainframe developers is still in demand even though it is has gained the status of legacy technology. In this section, we will see what are the most commonly asked mainframe interview questions covering concepts on COBOL as well as JCL that will help developers crack mainframe interviews.
Mainframe computers are a combination of different processors and RAM (memory). They work as a CPU for multiple workstations and terminals associated with it. They are used for performing huge data operations of the range of petabytes which would allow processing requests for thousands of users. The term 'Mainframe' represents a frame to hold main memory and multiple processors. These computers are used for processing requests in real-time in e-commerce, banking, education. government and various other applications. The following diagram represents the view of the Mainframe system.
COBOL expands to Common Business Oriented Language. This is an object-oriented, procedural and imperative language that was developed as a result of research and work from the US Department of Defence in the 1950s to develop common means of communicating across different mainframes. Following are the features of COBOL:
DRDA represents Distributed Relational Database Architecture that behaves as a connection protocol meant for processing of local database. This is mainly used by vendors such as IBM. The architecture consists of rules that aid in the communication of applications and databases.
Self-referencing constraints are used for restricting changes that can be possibly made to a primary key using a foreign key. For achieving this, the foreign keys need to define the DELETE-CASCADE rule which states that in case the relationship for DELETE rule is defined as CASCADE, if one row is changed or deleted, then other rows in the table are recursively deleted.
Spool stands for Simultaneous Peripheral Operations On-Line which is used as buffering mechanism where data would be stored temporarily, processed and executed later.
SEARCH and SEARCH ALL is used for finding if a record is present in a table or not.
SEARCH | SEARCH ALL |
---|---|
Uses linear search for finding record(s) in the table. This is also called a sequential search. | Uses Binary Search for finding record(s) in the table. |
Here, the table does not require data to be available in sorted order. | Here, the data in the table needs to be present in sorted order (either ascending or descending). |
The syntax for SEARCH is: |
The syntax for SEARCH ALL is:
COPYBOOK is used for storing the record format whose design can be used by another program too. One COPYBOOK can be used for multiple documents or programs by using REPLACING choice in case the formats are the same.
Index cardinality represents the number of discrete values or entries in a table column. DB2 has a utility called RUNSTATS which is used for examining column entry redundancy for finding whether an index scan is needed to search the data.
DBCTL stands for Database Control and is an address space and is used for accessing IMS (Information Management System) files for CICS (Customer Information Control System) transactions. It is used to access IMS files for CICS Transactions and it is address space. For more information, you can refer here.
UPDATE cursor is a pointer that permits us to modify or delete the current recently fetched row. UPDATE Keyword lets the information server know that the instruction would modify or delete any row it fetches from the database.
They are most commonly used declarations for implying restrictive factors which let to take decisions under specific program conditions. They are also used for improving program readability. They are also used for giving names to conditions which is why they are also known as "Condition Names".
JCL expands to Job Control Language and is a scripting language that is used for providing required specifications for processing a job. It consists of a set of control statements and acts as an interface between the IBM Mainframe Operating System and COBOL programs. JCL statements also do the task of notifying the OS for finding required input data and provides instructions on what operations need to be performed on that input and what needs to be done with the result.
There are majorly 3 types of JCL statements:
SYNC is a Keyword in COBOL used for aligning the storage area (data) to a word-boundary that represents any address that is multiple of 4. This is done to ensure computations are efficient when data is read from word-boundary by the Mainframe server.
Global variables are those variables that are available only to batch programs whereas external variables are those variables that are accessible by any batch programs in same system library.
Conditional statements are used for changing the flow of execution based on conditions specified. The conditions always must evaluate to true or false. Following are the different types of conditional statements:
For more information, you can refer here.
Index | Subscript |
---|---|
Index represents the number of displacement positions of the array. | Subscript is the number of occurrences of the array. |
Index does not require a separate declaration. INDEX BY is used to declare index. |
Subscript requires separate declaration with S9(04) COMP in WORKING-STORAGE SECTION. |
Helps in faster access of data in the table. | Is slower in accessing data item. |
Uses SET statement to initialize index. | Uses MOVE statement to initialize subscript. |
Can decrease by using SET DOWN BY statement and SET UP BY statement is used to increase index. | ADD statement is used to increase subscript and SUBTRACT is used to decrease it. |
There are 3 types of locks.
FOR UPDATE OF
clause.DCB stands for Data Control Block. DCB parameter in DD (Data definition) statements helps to detail out the physical characteristics of a dataset that are newly created in the job step.
We need to do the following steps:
AMODE=31
and RMODE=ANY
.SIZE(MAX)
.JOBLIB is a DD statement that determines the program location that is called EXEC statement. The statement applies to all the steps of the entire job but can not be used for catalogued procedures.
STEPLIB is similar to JOBLIB and is used for determining the dataset where the program is present. It applies only to the step that it is part of and not the whole job. This can be used at any step in the job and also in catalogued procedures.
If both STEPLIB and JOBLIB are used, then priority is given to STEPLIB thereby ignoring JOBLIB by the system.
Deadlock occurs in the case where two or more mainframe programs gets an exclusive lock on the resource which cant execute until the data is accessed. In case the error occurs, we can roll back the current work unit of any one of the programs after a specified preset deadlock time interval and thereby terminating the program.
The most common cause of SOC-7 error is problematic data associated with an uninitialized numeric item. We can get hold of dumps of run-time abends by performing some setups like invoking Operating System Services using assembly languages. Using these dumps, we can get the exact location of instruction where the abend has occurred. Using this, we can verify the XREF output that lists the compilation to get the line number and verb of the source code of the instruction error offset. Runtime dumps can be captured by defining datasets as Sysabout (for example) in JCL. We can also make use of the debugging utilities provided by the setups. When none of the methods is working, we need to find the error location by making use of good judgement and understanding of the system developed.
EVALUATE Statements are of different types:
COMMIT statements are used for releasing locks that are needed for that particular work unit and then allow new work units. In case, COMMITS are not part of the program, then during processing of the program, it has to go back to the inserts that were made during the program run instead of going back to few inserts near the most recent commit. This process takes 2 or 3 times extra time than the time taken for program execution.
Whenever data is requested from the memory, the CPU first hits the primary memory, i.e RAM and checks if the requested data is present on that page in the memory. If it is not present, then the CPU performs paging on secondary memory, i.e reads data from hard disk in equal blocks of memories called pages. During paging, a frame constitutes a single page of physical memory and it need not be physically contiguous. This ensures faster memory access and ensures data is fetched faster from secondary memory.
We can understand it by looking at the linkage editor output or from the load module. In case the module is called dynamically, then that will not be part of the main module. If it is called, statically, then we can see the details of the module in the load module. There is one more type of module calling known as an IMPLICIT calling which identifies the module name by getting implications from the content of the storage variable consisting of the program name.
Internal sort is handled by the COBOL program by making use of input file, work file and output file. Here, recompiling of the COBOL program is needed when any kind of processing is done. Internal Sort uses two types of syntaxes:
External sort is not based on COBOL and utilizes direct use of SORT utility and is performed by making use of JCL and PGM=SORT.
For more information, you can refer here
JCL is used for processing work by the z/OS system by defining which program needs to be executed, what resources need to be allocated, etc. The description of work specified is called a job. z/OS system makes use of JES (Job Entry Subsystem) that receives jobs into the OS, schedules them and processes them and controls their output.
Following are the phases of job processing:
This can be done by making use of the RETURN-CODE keyword which can be used for passing information to the JCL from the COBOL program. We can use it for identifying the outcome of any operation. Generally, the program activity returns 0,4,8 or 12 in cases of success or irregularities. We can change it by making use of this keyword which also ensures that the information is passed from COBOL to JCL.
We can do the following steps in order to avoid deadlocks:
FOR UPDATE
clause which ensures that U lock is set when process tries reading data during select operation. This clause does not allow row-blocking.WITH RR
or WITH RS
USE AND KEEP UPDATE LOCKS
In case our DB2 table has an identity column, then we can use the indexnum as follows:
Update Table SET COLUMN_NAME=XXX where indexnum < 101
We can use SORTWK01, SORTWK02, and so on in the step. There needs to be a minimum of 3 datasets, but in general, the number of sort datasets is proportionate to the volume of a dataset that needs to be sorted.
Yes, it is possible by making use of REDEFINES
. We need to keep in mind that redefining just ensure fields start from the same location.
We can mention SYSIN and SYSOUT dataset names in the SORT step. Additionally, we need to mention SORT FIELDS = COPY in the sort card to copy data from one dataset to another.
We can make use of NOTIFY statement as:
NOTIFY = userid to whom status needs to be notified
which notifies the user about job completion along with the return code.
It has to be noted that the job log of the spool would contain information under the job submitter's id.
We can make use of the RD parameter in JOB/EXEC statement by specifying for what abend codes RESTART needs to be performed in the SCHEDxx member of parmlib library of the IBM system.
In case the file is empty and is used as input in IDCAMS, then the job completes with return code 4. By verifying this return code, we can identify that the file is empty.
In this section, we have seen the most commonly asked mainframe interview questions. We have also covered JCL interview questions, COBOL interview questions and various application type problems that are essential for clearing job interviews for both freshers and experienced.