COBOL Interview Questions and Answers (Mainframe + JCL)
COBOL interview questions cover the four program divisions, PIC clause syntax, file handling verbs, PERFORM loops, condition names, and JCL basics like DD statements and job steps. This guide prepares freshers and experienced candidates for mainframe roles in 2026, including batch processing and legacy system integration scenarios.
What Are COBOL Interview Questions?
COBOL interview questions test your knowledge of program structure, data types, file I/O, and JCL. For mainframe roles, interviewers at companies like TCS, Infosys, and Cognizant India combine syntax questions with scenario-based problems around batch workflows, VSAM file handling, and DB2 embedded SQL.
Core COBOL Interview Questions Every Candidate Gets Asked
Most interviewers start with fundamentals before moving to real-world scenarios. Get these right and you immediately signal you know the language, not just the theory.
COBOL Program Structure
COBOL programs are divided into four divisions: IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE. Every question about program layout traces back to this. Interviewers love asking which division handles file connectivity (ENVIRONMENT) versus variable declaration (DATA).
The DATA DIVISION itself splits into the FILE SECTION, WORKING-STORAGE SECTION, and LINKAGE SECTION. Know what each one does. If you confuse WORKING-STORAGE with LINKAGE, you will lose marks fast.
COBOL Interview Questions for Freshers: Common Syntax Topics
- What is a PIC clause? It defines the data type and size of a variable. PIC 9(5) means a five-digit numeric field.
- What does COMP-3 mean? Packed decimal storage, used to save space for numeric data on mainframes.
- What is the difference between MOVE and INITIALIZE? MOVE assigns a specific value; INITIALIZE resets a variable to its default (zero for numeric, spaces for alphanumeric).
- What is 88-level? A condition name. It lets you write readable conditionals like IF CUSTOMER-STATUS = ACTIVE instead of checking raw numeric codes.
- What does REDEFINES do? It lets two data items share the same memory area, useful for interpreting a field in multiple formats.
- What are COBOL copybooks? Reusable data definitions stored in a library and included in programs using the COPY statement. They enforce consistent record layouts across multiple programs.
File Handling Questions
File I/O is the heart of COBOL batch programming. Expect questions on OPEN, READ, WRITE, REWRITE, DELETE, and CLOSE. Know the difference between SEQUENTIAL, INDEXED, and RELATIVE file organisations.
A classic question: what happens if you READ past the end of a sequential file without an AT END clause? The program abends. Always code defensively with AT END or a FILE STATUS variable like FS-CODE.
| File Organisation | Access Mode | Typical Use Case |
|---|---|---|
| Sequential | Sequential only | Batch report generation, payroll runs |
| Indexed (VSAM KSDS) | Sequential or Random | Customer master files, account lookups |
| Relative | Sequential or Random | Fixed-position table lookups |
Key Takeaway
Master file status codes. Code 00 means success; 10 means end of file on a sequential read. Interviewers at TCS, Infosys, and Wipro routinely ask you to interpret a FILE STATUS value in a live scenario.
PERFORM and EVALUATE
PERFORM is COBOL’s loop and subroutine call mechanism. PERFORM UNTIL loops until a condition is true. PERFORM VARYING is used for table processing. Know both cold.
EVALUATE is COBOL’s equivalent of a switch-case. EVALUATE TRUE paired with WHEN condition makes complex business logic readable. Interviewers test whether you can refactor nested IF statements into an EVALUATE block.
COBOL Interview Questions for Experienced Developers and Mainframe Roles
Senior roles go beyond syntax. You will get scenario questions, performance tuning, VSAM internals, CICS basics, and system design around z/OS batch processing workflows. These are the questions that separate a two-year fresher from a five-year practitioner.
VSAM and CICS Basics
VSAM (Virtual Storage Access Method) is IBM’s file management system on z/OS. Experienced candidates must know the difference between KSDS (Key Sequenced Data Set), ESDS (Entry Sequenced), and RRDS (Relative Record). KSDS is the most common because it supports keyed random access, which is how most mainframe applications query customer data.
CICS (Customer Information Control System) is the transaction server that lets COBOL programs run online, not just in batch. Expect questions about EXEC CICS commands like SEND MAP, RECEIVE MAP, READ FILE, and RETURN. If you have worked in banking or insurance mainframes in India, you have almost certainly touched CICS. Firms like Capgemini India and HCL Technologies maintain large CICS-based systems for global banking clients.
DB2 and Embedded SQL
Many mainframe COBOL programs embed SQL to query DB2 databases. Know the SQLCA structure, especially SQLCODE. A SQLCODE of 0 means success; +100 means no rows found; negative values mean errors. Interviewers ask you to trace a program that returns SQLCODE -805 and explain what it means (package not found).
Cursor handling is another hot topic. DECLARE CURSOR, OPEN, FETCH, and CLOSE make up the standard pattern for processing multi-row result sets in embedded SQL. Write this from memory in an interview and you will impress.
Performance and Optimisation
Senior COBOL interview questions often include: how do you tune a slow batch job? Common answers include using COMP or COMP-3 for numeric fields to reduce CPU cycles, avoiding unnecessary file opens inside loops, and using the SORT utility instead of in-program sorting for large datasets. IBM’s z/OS COBOL Programming Guide confirms that packed decimal arithmetic (COMP-3) can reduce storage by up to 50% compared to zoned decimal.
ABEND Codes You Must Know
| ABEND Code | Meaning | Common Cause |
|---|---|---|
| S0C7 | Data exception | Non-numeric data moved into a numeric field |
| S322 | CPU time exceeded | Infinite loop or runaway batch job |
| S806 | Load module not found | Missing program in the load library |
| S0C4 | Protection exception | Invalid memory address reference |
Is COBOL Still in Demand in 2026?
Yes, genuinely. According to IBM’s 2023 COBOL Survey, there are over 800 billion lines of COBOL code still running in production globally, processing an estimated $3 trillion in daily commerce. The US Federal Reserve, major Indian public sector banks, and insurance conglomerates all run COBOL backends.
The talent pipeline is shrinking, not growing. The average COBOL developer is over 55 years old, according to Micro Focus (now OpenText). That creates real hiring pressure for companies like SBI, LIC, and HDFC Bank that maintain mainframe infrastructure. If you are deciding between career paths, it is worth reading whether AI can actually replace coders before writing off legacy skills entirely.
COBOL is not glamorous. But it pays well precisely because fewer people know it. In India, mainframe COBOL developers with five or more years of experience command salaries between Rs 12-22 LPA, according to Naukri.com salary data from January 2026.
JCL Interview Questions
JCL (Job Control Language) is what runs COBOL programs on z/OS. You cannot do a mainframe interview without JCL questions. The three core statement types are JOB, EXEC, and DD.
- JOB statement: Identifies the job to the operating system and sets accounting, class, and priority parameters.
- EXEC statement: Calls a program (PGM=) or a catalogued procedure (PROC=).
- DD statement: Defines data sets, including input files, output files, and temporary datasets using DSN= and DISP=.
Common JCL questions include: what does DISP=(NEW,CATLG,DELETE) mean? It means create a new dataset, catalogue it if the step succeeds, and delete it if the step fails. Interviewers also ask about SYSOUT=* (route output to the default print class) and REGION= (memory allocation for the job step).
Conditional execution using the COND parameter or IF/THEN/ELSE/ENDIF constructs in JCL is a senior-level topic. Know that COND=(4,LT) means skip this step if the previous return code is less than 4.
If you are building a broader technical career around systems and infrastructure, the path from mainframe to modern DevOps is more connected than people think. Check out how to become a DevOps engineer if you want to bridge that gap.
Preparing for a Mainframe Interview: Practical Steps
- Set up a practice environment. IBM offers the Hercules emulator and z/OS free trials. Use them to write and run actual JCL and COBOL programs.
- Study IBM manuals, not just tutorials. The IBM z/OS COBOL Programming Guide is freely available and is what senior developers actually reference.
- Practice file status codes and ABEND codes cold. S0C7 (data exception), S322 (CPU time exceeded), and S806 (load module not found) come up in every experienced-level interview.
- Revise SORT and IDCAMS utilities. Batch jobs use these constantly and interviewers assume you know them.
- Do mock interviews with scenario questions. A batch job is running for 6 hours instead of 2. Walk me through your diagnosis. Practice answering out loud.
If you are comparing this track against modern full-stack work, this breakdown of full-stack vs software developer careers gives useful context for making that choice.
Frequently Asked Questions
What are common COBOL interview questions?
Common questions cover the four divisions of a COBOL program, PIC clause syntax, file handling verbs like READ and REWRITE, PERFORM loops, EVALUATE statements, and 88-level condition names. Freshers should also expect questions on WORKING-STORAGE versus LINKAGE SECTION and the difference between COMP and COMP-3 data types.
What COBOL questions are asked for experienced developers?
Experienced candidates face questions on VSAM file types, embedded DB2 SQL with cursor handling, CICS transaction commands, performance tuning techniques like packed decimal arithmetic, and ABEND code diagnosis. Scenario questions, such as tracing a slow batch job or interpreting a negative SQLCODE, are standard at the senior level in companies like TCS and Infosys.
How do I prepare for a mainframe interview?
Practice on a real or emulated z/OS environment, study IBM’s official COBOL and JCL documentation, memorise common ABEND codes and FILE STATUS codes, and rehearse scenario-based answers out loud. Revise SORT, IDCAMS, and VSAM utilities. Most Indian IT services firms test practical knowledge, not just definitions.
What JCL questions come up with COBOL?
Expect questions on JOB, EXEC, and DD statement syntax, DISP parameter values, SYSOUT routing, REGION allocation, and conditional execution using COND or IF/THEN/ELSE. Senior roles also test PROC definitions, symbolic parameters, and OVERRIDE syntax. JCL is inseparable from COBOL in any real mainframe batch environment.
Is COBOL still in demand in 2026?
Yes. IBM reports over 800 billion lines of COBOL in production globally, processing trillions in daily transactions. With the average COBOL developer ageing out of the workforce, demand for skilled practitioners is rising, particularly in Indian public sector banks, insurance companies, and IT services firms maintaining legacy mainframe systems for global clients.
Last updated: June 2026. Reviewed by the 3.0 University editorial team.


