COBOL Interview Questions Answers 2

Latest COBOL Interview Questions Answers 

These questions can be expected in top companies.

Explain the difference between search and search all in the table handling?
Answer : Search is a linear search whereas search all is a binary search.

What do you mean by REPORT-ITEM?
Answer : A REPORT-item is a field to be printed that contains EDIT SYMBOLS

You are writing report program with 4 levels of totals:city,state,region and country. The codes being used can be the same over the different levels, meaning a city code of 01 can be in any number of states, and the same applies to state and region code show. Do you do your checking for breaks and how do you do add to each level?

Answer : Always compare on the highest-level first, because if you have a break at a highest level, each level beneath it must also break. Add to the lowest level for each rec but add to the higher level only on break.

Explain what is the main significance and importance of GLOBAL clause According to new standards of COBOL

Answer : When any data name, file-name , Record-name, condition name or Index defined in an Including Program can be referenced by a directly or indirectly in an included program, Provided the said name has been declared to be a global name by GLOBAL Format of Global Clause is01 data-1 PIC 9(5) IS GLOBAL.

What is the significance of POINTER Phrase in STRING command in COBOL.

Answer : The Purpose of POINTER phrase is to specify the leftmost position within receiving field where the first transferred character will be stored

Explain how can we get currentdate from system with century?

Answer : By using Intrinsic function, FUNCTION CURRENT-DATE

Explain what is PSB and ACB in COBOL?

Answer : PSB : Program specification block. Inform about how a specific program is to be access one or more IMS DB. It consists of PCB(Prg Communication Block). Information to which segment in DB can be accessed, what the program is allowed to do with those segment and how the DB is to be accessed. 
ACB : Access Control Blocks are generated by IMS as an expansion of information contained in the PSB in order to speed up the access to the applicable DBD's.

Explain the difference between a DYNAMIC and STATIC call in COBOL.

Answer : To correct an earlier answer:All called modules cannot run standalone if they require program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect null address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.

What is the maximum length of a field you can define using COMP-3?

Answer : 10 Bytes (S9(18) COMP-3).

Explain how many Sections are there in Data Division in COBOL?

Answer : SIX SECTIONS 1.'FILE SECTION' 2.'WORKING-STORAGE SECTION' 3.'LOCAL-STORAGE SECTION' 4.'SCREEN SECTION' 5.'REPORT SECTION' 6.'LINKAGE SECTION'
In COBOL II, there are only 4 sections. 1.'FILE SECTION' 2.'WORKING-STORAGE SECTION' 3.'LOCAL-STORAGE SECTION' 4.'LINKAGE SECTION'.

Explain how can you tell if a module is being called DYNAMICALLY or STATICALLY?

Answer : The ONLY way is to look at the output of the linkage editor (IEWL)or the load module itself. If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be seen in the load module. 

Calling a working storage variable, containing a program name, does not make a DYNAMIC call. This type of calling is known as IMPLICITE calling as the name of the module is implied by the contents of the working storage variable. Calling a program name literal (CALL).

What do you mean by a LDS(Linear Data Set) and what's it used for ?

Answer : LDS is a VSAM dataset in name only. It has unstructured 4k (4096 bytes) fixed size CIs which do not contain control fields and therefore from VSAM's standpoint they do not contain any logical records. There is no freespace, and no access from Cobol. Can be accessed by DB2 and IMS fast path datasets. LDS is essentially a table of data maintained on disk. The 'table entries' must be created via a user program and can only be logically accessed via a user program. When passed, the entire LDS must be mapped into storage, then data is accessed via base and displacement type processing.

Explain what is Pic 9v99 Indicates in COBOL?

Answer : PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position; the v means an implied decimal point.

What are the guidelines that should be followed to write a structured COBOL program?

Answer : 
1) Use 'EVALUATE' stmt for constructing cases.
2) Use scope terminators for nesting.
3)Use in-line Perform stmt for writing 'do ' constructions.
4) Use Test Before and test after in the Perform stmt for writing Do-While constructions.

Read the following code.
01 ws-n PIC 9(2) value zero.
a-para.
move 5 to ws-n.
perform b-para ws-n times.
b-para.
move 10 to ws-n.


Can you tell me how many times will b-para be executed ?

Answer : 5 Times only. it will not take the value 10 that is initialized in the loop.

Can you tell me how is PIC 9.99 is different from PIC 9v99 in COBOL?
Answer : PIC 9.99 is a four position field that actually contains a decimal point whereas 9v99 is a three position numeric field with an implied or assumed decimal point.

Explain what is the main difference between PIC 9.99 and 9v99?

Answer : PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE-POSITION numeric field with implied or assumed decimal position.
Related Posts

No comments:

 

Aired | Copyright © 2009-2014| All Rights Reserved 2014

Contact Us | About Us