Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

How do you avoid deadlocks while reading data in Mainframe?

Answer»

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

How do you pass incentives from JCL to COBOL?

Answer»

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.

3.

What are the different stages of processing a job?

Answer»

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

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

Answer»
  • 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.
5.

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

Answer»

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.

6.

How does paging work in the memory?

Answer»

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.

7.

What is the importance of coding COMMITS in batch programs?

Answer»

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.

8.

What steps do you follow to create a COBOL program?

Answer»
  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.
9.

What are the various forms of Evaluate Statements?

Answer»

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

How will you repair the SOC-7 error?

Answer»

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.

11.

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

Answer»

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.

12.

What happens if both STEPLIB and JOBLIB statements are specified?

Answer»
  • 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.
13.

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

Answer»

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

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

Answer»

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

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

Answer»

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

Difference between index and subscript.

Answer»
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.