Cracking an interview has never been easy as history states. The questions that an interview asks are unpredictable and are quite difficult to answer if you don’t what the answer is. However, these one or two questions that you have not answered might decide your future as the interviewer can reject your application stating some obvious reasons which cannot be neglected. Therefore, to crack an interview with flying colors, leverage our COBOL interview questions and answers that are prepared by experts and professionals who have adequate knowledge and expertise in this field.
COBOL or Common Business Oriented Language is a programming language that is considered to be of high level and is mostly used to develop business applications. It is also popularly known as the first language that was designed to be OS-agnostic and is also used until now to develop financial as well as business applications. COBOL was introduced for business computer-based programs in industries like finance or human resources. COBOL mostly uses normal English words and some phrases to make it completely easier to operate all the ordinary businesses easily so that the users understand the language without facing any hassles or troubles.
COBOL stands for Common Business-Oriented Language. The US Department of Defense, in a conference, formed CODASYL (Conference on Data Systems Language) to develop a language for meeting business data processing needs which are now known as COBOL.
COBOL is a standard language that can be compiled and executed on various machines. It is ideally suited for business-oriented applications as it can handle huge volumes of data. It provides numerous debugging and testing tools. COBOL is a structured language; it has different divisions, so it is easy to debug.
Identification Division, Environment Division, Data Division, and Procedure Division.
Alpha-numeric (X), Alphabetic (A), and Numeric (9).
IS NUMERIC clause is used to check if any item is numeric or not. It returns TRUE when the item against which it is used contains only numbers (0 to 9). The item can be positive or negative.
Level 66 is used for RENAMES clause and Level 88 is used for condition names.
Subscript is the occurrence in an array. An index is a displacement from the beginning of an array.
SEARCH is a serial search, whereas SEARCH ALL is a binary search. A table must be in sorted order before using SEARCH ALL.
Search on a sorted array. Compare the item to be searched with the item at the center. If it matches, fine else repeat the process with the left half or the right half depending on where the item lies.
Must use compiler option STRANGE if you want array bounds checking. Default is NOSSRANGE.
Use the SORTWK01, SORTWK02,..... dd names in the step. The number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.
Performing a SECTION will cause all the paragraphs that are part of the section, to be performed. Performing a PARAGRAPH will cause only that paragraph to be performed.
Evaluate is like a case statement and can be used to replace nested Ifs. The difference between EVALUATE and case is that no break is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match is made.
EVALUATE EVALUATE SQLCODE ALSO FILE-STATUS
WHEN A=B AND C=D WHEN 100 ALSO 00
imperative stmt imperative stmt
WHEN (D+X)/Y = 4 WHEN -305 ALSO 32
imperative stmt imperative stmt
WHEN OTHER WHEN OTHER
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE
EVALUATE SQLCODE ALSO A=B EVALUATE SQLCODE ALSO TRUE
WHEN 100 IS ALSO TRUE WHEN 100 ALSO A=B
imperative stmt imperative stmt
WHEN -305 ALSO FALSE WHEN -305 ALSO (A/C=4)
imperative stmt imperative stmt
END-EVALUATE END-EVALUATE.
After the execution of one of the when clauses, the control is automatically passed on to the next sentence after the EVALUATE statement. There is no need for any extra code.
Scope terminator is used to marking the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.
PERFORM ... ...
END PERFORM.
When the body of the performance will not be used in other paragraphs. If the body of the performance is a generic type of code (used from various other places in the program), it would be better to put the code in a separate para and use PERFORM para name rather than in-line perform.
CONTINUE is like a null statement (do nothing), while NEXT SENTENCE transfers control to the next sentence (!!) (A sentence is terminated by a period).
Does nothing! If used, must be the only sentence within a paragraph.
Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage. Zoned Decimal fields: As a default, a sign is over punched with the numeric value stored in the last bite.
It is stored in the last nibble. For example, if your number is +100, it stores hex 0C in the last byte, hex 1C if your number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is -102, etc...
In the most significant bit. A bit is on if -ve, off if +ve.
COMP is a binary storage format while COMP-3 is packed decimal format.
COMP-1 - Single precision floating point. Uses 4 bytes.
COMP-2 - Double precision floating point. Uses 8 bytes.
No picture clause is to be given. Example 01 WS-VAR USAGE COMP-1.
Will take 4 bytes. A sign is stored as a hex value in the last nibble.
General formula is INT((n/2) + 1)), where n=7 in this example.
Will occupy 8 bytes (one extra byte for sign).
4 bytes.
99999999
Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT.
For binary data items, the address resolution is faster if they are located at word boundaries in the memory. For example, on a mainframe, the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If my first variable is x(3) and the next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start from byte 3 ( assuming that it starts from 0 ). If you specify SYNC, then the binary data item will start from address 4. You might see some wastage of memory, but access to this computational field is faster.
In COBOL II: 16777215.
Open for INPUT, OUTPUT, I-O, EXTEND.
OUTPUT, EXTEND.
As there are lots of financial institutions that use this application to make their processes smoother and easier, if you are well-versed with COBOL language programming, then you definitely have an opportunity to pursue your career in this field without thinking much. The opportunities in this field are incredible for the freshers as well as experienced. Don’t miss this opportunity at all. For a fresher, he or she has scope to make about 83,000 dollars per annum, while for an experienced candidate, he or she can up to 150,000 dollars per annum based on the skill set he or she is possessing.
Cracking an interview has never been so easy before as you have the option to explore our COBOL interview questions and answers that are prepared by our experts. In case of any doubts or discrepancies, you can feel free to drop us a message and we will look into it as soon as possible.