Mainframe Interview Questions for Fresher?(2022)




1. What are Mainframe computers?

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.

2. What is COBOL?

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:

  • COBOL was one of the first high-level programming languages developed which is meant to be user-friendly due to its English-like syntax.
  • It is widely used as a self-documenting language.
  • It is capable of handling, processing, and outputting huge data.
  • It has effective support for error messages which helps to resolve bugs easily.

3. Define DRDA.

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.

4. What do you understand by self-referencing constraints?

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.

5. What is a spool?

Spool stands for Simultaneous Peripheral Operations On-Line which is used as buffering mechanism where data would be stored temporarily, processed and executed later.

6. Differentiate between SEARCH and SEARCH ALL.

SEARCH and SEARCH ALL is used for finding if a record is present in a table or not.

SEARCHSEARCH 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: 

SEARCH TABLE-NAME [VARYING {identifier1/index1}] [AT END Statement]
{WHEN ConditionPasses  
{statement/NEXT SENTENCE/CONTINUE}
…
}  
END-SEARCH.

The syntax for SEARCH ALL is:

SEARCH ALL TABLE-NAME  
[AT END Statement]
{WHEN ConditionPasses  
{statement/NEXT SENTENCE/CONTINUE}
…
}  
END-SEARCH.

7. Define COPYBOOK in COBOL.

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.

8. What is index cardinality in DB2?

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.

9. What is the importance of DBCTL?

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.

10. Define UPDATE cursor.

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.

11. Where are 88 levels utilized in COBOL?

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”.

12. Define JCL.

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 provide instructions on what operations need to be performed on that input and what needs to be done with the result.

13. What are the types of JCL statements available for running a job?

There are majorly 3 types of JCL statements:

  • The first type consists of statements meant for identifying units of work that are to be performed by the Operating System.
  • The second type of statement is the EXEC statement which depends on the number of steps involved in running a job.
  • The third type of statements are called DD (Data Definition) statements that are meant for identifying input and output data sets.

14. What is COMP SYNC?

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.

15. How are static and dynamic linking achieved?

  • Static linking requires a calling program to call the subroutine links.
  • In dynamic linking, the calling program and the subroutine links can exist as different modules.
  • Both types of linking can be done by choosing either NODYNAM or DYNAM link edit options.

16. How are global and external variables different from each other?

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 the same system library.

17. What are the different types of conditional statements present in COBOL?

Conditional statements are used for changing the flow of execution based on conditions specified. The conditions always must evaluate as true or false. Following are the different types of conditional statements:

  • IF Condition
  • Relation Condition
  • Class Condition
  • Sign Condition
  • Negated Condition
  • Condition-Name Condition
  • Combined Condition.

Mainframe Interview Questions for Experienced

18. Difference between index and subscript.

IndexSubscript
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 items.
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.

19. How many types of locks are there and what are their functions?

There are 3 types of locks.

  • Shared lock: – This lock can ensure that two or more mainframe programs can read from the locked resource at a time but modifying is not allowed.
    • This lock is also called a read lock as it is used only for reading data items.
    • Since these are read locks, they support read integrity and ensures that when a record is being read, that won't be updated.
    • Shared locks can also be used to prevent any kind of updates of record.
    • Consider a scenario where we have A=100 initially and we have 2 transactions that want to read A. If one among them wants to update or modify A, then there are chances where the other transaction would read the wrong value. Here, if we use a shared lock, the data updation would be prevented until the transaction has completed reading.
  • Update lock: – This lock allows the program to use the shared or locked resource to change it.
    • This lock requires TABLESPACE OR LOCKSIZE TABLE along with cursor-based SELECT having FOR UPDATE OF clause.
    • A table with this lock allows data read but does not allow modification of the locked data. Whenever the application tries to update the data, the U lock will be promoted to Exclusive Lock.
  • Exclusive lock: – This lock restricts all user types to access locked space.
    • Consider an example where A=100 initially, and we have a transaction that wants to deduct some value say 25 from A. This can be allowed by placing an exclusive lock on A so that whenever any other transaction wants to read or write from it, the lock prevents it.

20. What is the importance of the DCB parameter in DD statements?

DCB stands for Data Control Block. DCB parameter in DD (Data definition) statements helps to detail out the physical characteristics of datasets that are newly created in the job step.

  • LRECL: signifies what is the length of record that can be held within a dataset.
  • RECFM: signifies record format type of the datasets.

21. What needs to be done to ensure the program executes above 16 Meg Line?

We need to do the following steps:

  • Ensure the link option is set to AMODE=31 and RMODE=ANY.
  • Compile option does not have SIZE(MAX).
  • For efficiency, BUFSIZE can be 2K.

22. What happens if both STEPLIB and JOBLIB statements are specified?

  • 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.

23. How to handle deadlock (-911 Error) in DB2 program?

Deadlock occurs in the case where two or more mainframe programs get 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.

24. How will you repair the SOC-7 error?

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.

25. What are the various forms of Evaluate Statements?

EVALUATE Statements are of different types:

  • Simple EVALUATE: This type of EVALUATE has only one condition for validation. It does so by validating the item in the WHEN phrase, if the item matches, then the statement below the WHEN phrase would get executed.
EVALUATE DAY
   WHEN 01
       DISPLAY 'MONDAY'
   WHEN 03
       DISPLAY 'WEDNESDAY'
   WHEN 05
       DISPLAY 'FRIDAY'
   WHEN OTHER
       DISPLAY 'Not alternate'
END-EVALUATE
  • EVALUATE TRUE: This type has boolean expressions and the WHEN phrases had logical expressions. If EVALUATE condition is True, then statements under WHEN where logical expression evaluates to TRUE is executed. If none of the WHEN evaluates to TRUE, then WHEN OTHER is executed.
EVALUATE TRUE
   WHEN WEEKDAY EQUAL 01
       DISPLAY 'MONDAY'
   WHEN WEEKDAY EQUAL 03
       DISPLAY 'WEDNESDAY'
   WHEN WEEKDAY EQUAL 05
       DISPLAY 'FRIDAY'
   WHEN OTHER
       DISPLAY 'NOT ALTERNATIVE'
END-EVALUATE
  • EVALUATE having THRU: EVALUATE THRU type is used for validating data where values are from a given range in contiguous and ascending order. The data item in the EVALUATE statement should belong to a range of values specified in the WHEN phrase to execute the statements. If values do not belong to the range, then statements under WHEN OTHER gets executed.
EVALUATE TOTAL-MARKS
   WHEN 70 THRU 100
       DISPLAY 'DISTINCTION'
   WHEN 50 THRU 69
       DISPLAY 'FIRST CLASS'
   WHEN 30 THRU 49
       DISPLAY 'SECOND CLASS'
   WHEN OTHER
       DISPLAY 'DID NOT PASS'
END-EVALUATE
  • EVALUATE having multiple WHEN conditions: This type is used for validating data items with a set of different values which require the same action to be performed. The WHEN statements are grouped and a set of steps to be executed is written. If anyone WHEN phrase gets matched, then the statements are executed.
EVALUATE TOTAL-GRADE
   WHEN 'A'
   WHEN 'B'
   WHEN 'C'
       DISPLAY 'PASS'
   WHEN OTHER
       DISPLAY 'DID NOT PASS'
END-EVALUATE
  • EVALUATE having MULTIPLE conditions: This type of EVALUATE is used for validating a set of multiple conditions which are combined by using ALSO. The number of objects in the WHEN phrase should be equal to the number of subjects in EVALUATE. If all expressions specified in WHEN is satisfied, then the statements below that WHEN is executed.
EVALUATE TRUE ALSO TRUE
   WHEN AGE > 018 ALSO GENDER = 'M'
       DISPLAY 'Man can Vote'
   WHEN AGE > 018 ALSO GENDER = 'F'
       DISPLAY 'Woman can Vote'
   WHEN AGE > 018 ALSO GENDER = 'U'
       DISPLAY 'Person can vote'
   WHEN OTHER
       DISPLAY 'Cant vote'
END-EVALUATE

26. What steps do you follow to create a COBOL program?

  1. Create all necessary tables in the database.
  2. Create DCLGEN (Declaration Generator). This is an optional step. Perform it only if needed.
  3. Pre-compile the program.
  4. Compile the program and perform Link Edit.
  5. Perform DB2 BIND.
  6. Execute the Program.

27. What is the importance of coding COMMITS in batch programs?

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.

28. How does paging work in the memory?

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.

29. How will you understand if your module is called statically or dynamically?

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.

30. What are the differences between external and internal sort? What are their syntaxes?

  • 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:
    • USING, GIVING sorts use no extra file processing.
    • INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow data manipulation before or after sort.
  • 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.

31. What are the different stages of processing a job?

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:

  • Input Phase: This is a phase for inputting the jobs utilizing using input devices like remote terminals, card readers, job entry networks, etc. We can also use internal readers that can be used by other programs for submitting the job, providing commands and control statements to JES2.
    • Whenever JES2 reads the input stream, a job identifier is assigned to each job and places every job’s JCL, control statements, SYSIN data etc onto DASD datasets which are called spool data sets. The spool has direct access to the datasets and provides the capability to perform simultaneous job processing and also provides a temporary storage area for incomplete jobs. JES2, later on, selects jobs from this spool and processes them.
  • Conversion Phase: This phase involves the usage of a converter program for analyzing every JCL statement and does the task of checking program syntax.
    • JES can also determine if JCL has any procedure calls. If there are any, then the convertor does the task of taking the job’s JCL, merges it with JCL by making use of the procedural library like SYS1.PROCLIB and converts composite JCL to internal text which is then stored in a spool.
    • During this conversion, if any errors are identified, then JES2 sends out appropriate error messages and queues them for output processing.
    • In case there are no errors in the job, then the job is queued for further processing based on the priority of its class.
  • Execution Phase: In this phase, the initiators are started either automatically or employing an operator at the time of system initialization. Once the initiator is ready, a job is requested from JES2 for execution.
    • JES2 selects the job and assigns it to the initiator based on the priority assigned for the order of execution.
    • The initiator invokes the interpreter for building the control blocks from the internal text created in the earlier step. It also allocates resources that are required for running the job.
    • Once sufficient resources are allocated, the program starts its execution as requested in the JCL EXEC statement.
  • Output Phase: Post the execution of the program, output processing is done for sending out system messages to the user. The job’s output characteristics are analyzed by JES2 based on the requirements and then queues for printing or punch processing. This queue is called an output queue which can contain records that require local or remote processing.
    • Once the output processing is complete, the jobs are sent to the purge queue and made ready for the purge phase.
  • Purge Phase: Post-processing of the job, JES2 picks it from the purge queue and releases the resources and spool space of the job to make it available for upcoming jobs. The purge indicator message will then be sent to the OS from the system.

32. How do you pass incentives from JCL to COBOL?

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.

33. How do you avoid deadlocks while reading data in Mainframe?

We can do the following steps in order to avoid deadlocks:

  • Use FOR UPDATE clause which ensures that U lock is set when a process tries reading data during select operation. This clause does not allow row-blocking.
  • Use the following clauses in queries that ensure U lock is set when a process tries to read the data and allows row-blocking:
    • WITH RR or WITH RS
    • USE AND KEEP UPDATE LOCKS

Mainframe Scenario Based Interview Questions

34. In case you have 1000 rows in the DB2 table, how will you update the column value of the first 100 records?

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

35. How will you define the sort file in JCL which runs the COBOL program?

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.

36. Is it possible to redefine X(100) field with X(200)? If yes, how?

Yes, it is possible by making use of REDEFINES. We need to keep in mind that redefining just ensures fields start from the same location.

01 WS-TOP PIC X(100)
01 WS-TOP-DOUBLE REDEFINES WS-TOP PIC X(200)

37. How will you copy data from one dataset to another dataset by using the SORT card?

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.

38. How will you inform other users about job completion?

We can make use of NOTIFY statement which notifies the user about job completion along with the return code.

NOTIFY = userid to whom status needs to be notified 

It has to be noted that the job log of the spool would contain information under the job submitter’s id.

39. How will you achieve auto restart when the job abends?

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.

40. How will you check if a file is empty in JCL?

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.

Mainframe MCQ

1.

What is the number of bytes occupied by the S9(8) COMP field?

2.

Which among the following option is relevant to the DD DISP parameter?

3.

What statement tells about the job step beginning by assigning a name to the job step, identifying a program that needs to be executed in the step?

4.

Where is the sign stored in the COMP field?

5.

What happens to Step 2 if Step 1 executes with return code 0?

//TXXXXXX JOB (XXXXX), 'XXXX'
//STEP1 EXEC PGM = PR1
//STEP2 EXEC PGM = PR2, COND = (0, EQ, STEP1)
6.

Which among the below option is used for checking the syntax of JCL code without actually executing it?

7.

Which among the below utility is used for running a COBOL DB2 Program?

8.

Which among the below option represents the correct flow of job processing?

9.

Which among the below option is used in RENAMES clause?

10.

What is the device that is used for accessing mainframe resources in the mainframe environment?


Comments

Popular posts from this blog

python interview questions 2022?

Java Basic Interview Questions?

How to Code – Coding for Beginners and How to Learn Programming for Free?