0% found this document useful (0 votes)
4 views12 pages

Mainframes Interview

basic mainframes questions. For interview preparations.

Uploaded by

urabhishek95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views12 pages

Mainframes Interview

basic mainframes questions. For interview preparations.

Uploaded by

urabhishek95
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ChatGPT

Give me some interview questions and its answers to ask


on topic PL1 programming, IMS database, DB2 database

Below are some interview questions along with their suggested answers for PL/I
programming, IMS database, and DB2 database.

PL/I Programming
Q1. What is PL/I and what are its key features?
A:
PL/I (Programming Language One) is a high-level programming language developed for
scientific, engineering, and business applications. Its key features include:

Support for both structured and unstructured programming.

Exception handling using ON units.

Powerful data handling capabilities, including arrays and structures.

Support for multitasking and multithreading.

Compatibility with both mainframe and modern systems.

Q2. Explain the difference between DO loops and DO WHILE loops in PL/I.
A:

DO loops execute a block of code a fixed number of times or until a specified condition
is met. Example:

pl1

DO i = 1 TO 10;
PUT LIST(i);
END;

1/12
DO WHILE loops execute the block of code as long as a specified condition remains true.
Example:

pl1

i = 1;
DO WHILE (i <= 10);
PUT LIST(i);
i = i + 1;
END;

Q3. How does PL/I handle dynamic storage allocation?


A:
PL/I uses the ALLOCATE and FREE statements for dynamic memory management.

ALLOCATE reserves storage at runtime.

FREE releases the allocated storage to avoid memory leaks.

Q4. What is an ON unit in PL/I? How is it used?


A:
An ON unit in PL/I is used for exception handling. It allows the programmer to define specific
actions when certain conditions (e.g., errors or interrupts) occur.
Example:

pl1

ON ERROR BEGIN;
PUT SKIP LIST('An error occurred.');
END;

IMS Database

2/12
Q5. What is an IMS database?
A:
IMS (Information Management System) is a hierarchical database management system
designed for high-performance and high-volume transaction processing. It is widely used in
mainframe environments for mission-critical applications.

Q6. What is the difference between a hierarchical database and a relational database?
A:

Hierarchical Database (e.g., IMS): Data is organized in a tree-like structure with parent-
child relationships. Fast for retrieving related data but less flexible.

Relational Database (e.g., DB2): Data is organized in tables with rows and columns, and
relationships are established using keys. More flexible and supports SQL queries.

Q7. Explain the difference between a Full Function and a Fast Path database in IMS.
A:

Full Function Database: Supports all IMS features, including complex data structures
and secondary indexes.

Fast Path Database: Optimized for high-speed transaction processing with limited
features. Used in high-performance scenarios.

Q8. What is the purpose of a Program Specification Block (PSB) in IMS?


A:
A PSB defines the programs' access permissions and views of the IMS database. It specifies:

Logical database views.

Access levels (read, update, etc.).

Segment sensitivity for each application program.

3/12
Q9. What is the difference between GSAM and VSAM in IMS?
A:

GSAM (General Sequential Access Method): A sequential access method used in IMS for
handling large volumes of sequential data.

VSAM (Virtual Storage Access Method): A file storage system used for storing data in
indexed, sequential, or relative datasets.

DB2 Database
Q10. What is DB2?
A:
DB2 is a relational database management system (RDBMS) developed by IBM. It is widely
used for storing, managing, and retrieving data efficiently in enterprise-level applications.

Q11. Explain the difference between a Primary Key and a Foreign Key in DB2.
A:

Primary Key: A unique identifier for each row in a table. No two rows can have the same
primary key value.

Foreign Key: A field in one table that references the primary key in another table,
establishing a relationship between the two tables.

Q12. What are DB2 Locks, and why are they important?
A:
Locks in DB2 prevent concurrent access issues by controlling how transactions interact with
data. They are important to maintain data integrity and consistency. Types of locks include:

Shared Lock (S): Allows read access to multiple transactions.

4/12
Exclusive Lock (X): Ensures only one transaction can modify the data.

Q13. What is an Index in DB2, and how does it improve performance?


A:
An index is a database object that improves data retrieval performance by providing a faster
access path to rows. It works like a table of contents, allowing the database to find data
without scanning the entire table.

Q14. How does DB2 handle concurrency?


A:
DB2 uses isolation levels to manage concurrency and ensure data consistency. Isolation
levels include:

Read Uncommitted.

Read Committed.

Repeatable Read.

Serializable.

Q15. What is the purpose of a Cursor in DB2?


A:
A cursor allows row-by-row processing of result sets retrieved by a SQL query. It is
particularly useful for handling large result sets or performing complex operations on each
row.
Example:

sql

DECLARE cursor_name CURSOR FOR SELECT column_name FROM table_name;

5/12
Let me know if you'd like to focus on specific areas or dive deeper into any of these topics!

Yes, some more questions and answers

Here are more advanced and detailed questions and answers for PL/I programming, IMS
database, and DB2 database:

PL/I Programming
Q16. What are the different storage classes in PL/I?
A:
PL/I supports several storage classes that define the duration and scope of variables:

1. Automatic ( AUTO ): Default for variables declared within procedures. Their lifetime is
limited to the execution of the procedure.

2. Static ( STATIC ): Retain their value between calls to the procedure or block where they
are declared.

3. Controlled ( CONTROLLED ): Storage is allocated dynamically using ALLOCATE and released


using FREE .

4. Based ( BASED ): Variables tied to a pointer, allowing dynamic memory management.

Q17. How does PL/I handle string manipulation?


A:
PL/I provides built-in string-handling functions, such as:

SUBSTR : Extracts a substring.


Example: SUBSTR('Hello World', 1, 5) returns 'Hello' .

INDEX : Finds the position of a substring.


Example: INDEX('Hello World', 'World') returns 7 .

VERIFY : Checks the occurrence of characters in a string.


Example: VERIFY('12345', '0123456789') returns 0 (all characters are valid).

6/12
Q18. What is the difference between CALL and ENTRY in PL/I?
A:

CALL : Used to invoke a procedure or subroutine.


Example: CALL myproc(); .

ENTRY : Defines an entry point within a program or procedure.


Example:

pl1

ENTRY myproc;
myproc: PROCEDURE;
PUT LIST('This is a procedure');
END myproc;

Q19. Explain the use of Area Variables in PL/I.


A:
Area variables define a block of storage that can be dynamically allocated and managed.
They are used with ALLOCATE , FREE , and LOCATE statements to manage dynamic data
structures.
Example:

pl1

DECLARE area_var AREA(100);


ALLOCATE buffer SET(buffer_ptr) IN(area_var);

Q20. How does PL/I ensure error handling with ON conditions?


A:
PL/I allows programmers to define specific actions for runtime errors or conditions using
ON . Common conditions include:

7/12
ON ERROR : Handles runtime errors.

ON OVERFLOW : Handles arithmetic overflow.

ON ENDFILE : Handles end-of-file conditions during file I/O.

IMS Database
Q21. What are the types of segments in IMS?
A:
IMS segments are the basic units of data in a database. Types include:

Root Segment: The topmost level in the hierarchy.

Parent Segment: A segment that has one or more child segments.

Child Segment: A segment under a parent.

Q22. What are the different access methods used in IMS databases?
A:
IMS uses the following access methods:

1. HSAM (Hierarchical Sequential Access Method): Sequential access to hierarchical data.

2. HDAM (Hierarchical Direct Access Method): Direct access without indexing.

3. HISAM (Hierarchical Indexed Sequential Access Method): Sequential access with


indexing.

4. SHISAM (Simple HISAM): Simplified HISAM for smaller datasets.

Q23. Explain the role of the DBDGEN and PSBGEN utilities in IMS.
A:

DBDGEN: Defines the database structure, including segments and their relationships. It
generates a Database Descriptor (DBD).

8/12
PSBGEN: Defines the program’s view and access to the database. It generates a Program
Specification Block (PSB).

Q24. How does IMS handle transaction management?


A:
IMS uses the Message Processing Region (MPR) to manage transactions. Key components
include:

Input Queue: Stores incoming messages.

Message Processing Program (MPP): Processes messages.

Output Queue: Stores the results of processing for delivery.

Q25. What is a Logical Database in IMS?


A:
A logical database is a user-defined view of one or more physical databases. It allows
multiple applications to work with the same data in different formats.

DB2 Database
Q26. What is the difference between a VIEW and a TABLE in DB2?
A:

TABLE: A physical structure storing data.

VIEW: A virtual table created using a SQL query. It does not store data but provides a
dynamic representation of data from one or more tables.

Q27. What is the purpose of a DB2 Plan?


A:

9/12
A DB2 Plan is a runtime structure containing optimized access paths for SQL statements. It is
created during the BIND process and is used by applications to access the database
efficiently.

Q28. Explain the use of Runstats in DB2.


A:
RUNSTATS collects statistical information about tables and indexes, such as:

Number of rows.

Distribution of values.

Clustering of data.
These statistics help the DB2 optimizer choose the best query execution plan.

Q29. What is the difference between a Package and a Plan in DB2?


A:

Package: Contains precompiled SQL code for a specific program or module. It is


modular and can be reused.

Plan: A collection of packages and access paths, representing the entire executable unit
for the application.

Q30. What are DB2 Triggers?


A:
Triggers are database objects that automatically execute specified SQL code in response to
certain events on a table or view.
Example:

sql

CREATE TRIGGER trg_insert AFTER INSERT ON employees


FOR EACH ROW

10/12
BEGIN
INSERT INTO audit_log (emp_id, action) VALUES (NEW.emp_id, 'INSERT');
END;

Q31. How does DB2 handle deadlocks?


A:
DB2 detects deadlocks automatically using a timeout mechanism. When a deadlock occurs,
one transaction is terminated (rolled back) to allow others to proceed. The terminated
transaction can be retried later.

Q32. What are DB2 Isolation Levels? Explain with examples.


A:
Isolation levels define how data is accessed by multiple transactions:

1. Read Uncommitted: Allows dirty reads (no locks).

2. Read Committed: Prevents dirty reads but allows non-repeatable reads.

3. Repeatable Read: Prevents non-repeatable reads but not phantom reads.

4. Serializable: Prevents all anomalies, including phantom reads.

Example:

sql

SET CURRENT ISOLATION LEVEL = 'READ COMMITTED';

Q33. What is the purpose of Buffer Pools in DB2?


A:
Buffer pools are memory areas that store frequently accessed data to reduce I/O operations
and improve performance. They act as a cache for DB2 tables and indexes.

11/12
Let me know if you'd like to explore specific topics in more detail!

12/12

You might also like