I faced the following questions in a recent interview.
1.If we use renames for regrouping, whether both the renamed one as well as the original group items will have the same storage area?
My answer was "No".
2.Can we rename 77 level elementery items.
My answer was 'No'. My understanding is only group level variables can be renamed.
3.Suppose we have a program A and the program is calling a subprogram B. If there is a mismatch in the number of actual parameters and formal parameters, what will happen?
My answer was the call will fail. Because if the formal parameters and actual parameters are matching then only the program will run properly.
4. Suppose there is a proc with DSN = File 1,File2, File3, File4, File5. And suppose he tries to override the same using file5, file6 and file7. from job. Which files will be taken by the program during run time.
Ans: File5,File6, File7 was my answer.
5.Can we overide the PGM=PGM1 in a proc with some other program.
Ans:We can use symbolic parameters for such overriding.
6. What is multiple entry points and multiple exit points in a cobol program.
Ans: I did not know the answer.
7. Can we use more than one linkage section in a cobol program.
Can anyone help me in finding the correct answers for these questions.
Joined: 06 Jun 2008 Posts: 8280 Location: Dubuque, Iowa, USA
There is a manuals link at the top of the page. Click it, find the COBOL Language Reference manual, go to section 5.3.14 on RENAMES and you will find:
1. The renamed area and the original area share the same storage.
2. 01, 77, 66, 88 levels cannot be renamed -- everything else, including elementary items, can be renamed.
3. The answer depends upon where the mismatch is. If program A calls program B using 6 parameters and program B only references 3 of them in the PROCEDURE DIVISION USING and LINKAGE SECTION, there is no error, no abend, and the programs can run to normal completion. If program A calls program B using 3 parameters and program B references 6 parameters in the PROCEDURE DIVISION USING and LINKAGE SECTION, the first reference to any of the last 3 values will cause S0C4 (most likely).
4. Question makes no sense -- are these concatenated files?
5. As worded, symbolic parameters aren't mentioned -- where did you add them from?
6. Check out the ENTRY statement in the COBOL Language Reference manual cited above.
7. The answer is in the COBOL Language Reference manual.
Sorry for title. Will definitely use a meaningful title from next post onwards.
As my questions were pointing to different topics, I thought it was appropriate. Anyway from next time onwards will try to find out a much meaningful title.