Wednesday, September 17, 2008

Cobol Interview Questions Part-6

83. What is the significance of 'above the line' and 'below the line'?

Ans: Before IBM introduced MVS/XA architecture in the 1980's a program's virtual storage was limited to 16 megs. Programs compiled with a 24-bit mode can only address 16 MB of space, as though they were kept under an imaginary storage line. With COBOL II a program compiled with a 31 bit mode can be 'above the 16 Mb line. (This 'below the line', 'above the line' imagery confuses most mainframe programmers, who tend to be a literal minded group.)

84. What was removed from COBOL in the COBOL II implementation?

Ans: Partial list: REMARKS, NOMINAL KEY, PAGE-COUNTER, CURRENT-DAY, TIME-OF-DAY, STATE, FLOW, COUNT, EXAMINE, EXHIBIT, READY TRACE and RESET TRACE.

85. Explain call by context by comparing it to other calls.

Ans: The parameters passed in a call by context are protected from modification by the called program. In a normal call they are able to be modified.

86. What is the difference between comp and comp-3 usage? Explain other COBOL usages.

Comp is a binary usage, while comp-3 indicates packed decimal. The other common usages are binary and display. Display is the default. Comp is defined as the fastest/preferred numeric data type for the machine it runs on. IBM Mainframes are typically binary and AS400's are packed.'

87. I understand the possible causes for S0C1 & S0C4 abends, but what are they really?

Ans: A S0C1 occurs if the CPU attempts to execute binary code that isn't a valid machine instruction; e.g. if you attempt to execute data. A S0C4 is a memory protection violation. This occurs if a program attempts to access storage beyond the areas assigned to it.

88. What happens when we move a comp-3 field to an edited ( say z(9).zz-)

Ans:The editing characters are to be used with data items with usage clause as display, which is the default. When you try displaying a data item with usage as computational it does not give the desired display format because the data item is stored as packed decimal. So if u want this particular data item to be edited u have to move it into a data item whose usage is display and then have that particular data item edited in the format desired.

89. What are the causes for S0C1, S0C4, S0C5, S0C7, S0CB abends

Ans:S0C1 - May be due to 1.Missing or misspelled DD name 2.Read/Write to unopened dataset 3.Read to dataset opened output 4.Write to dataset opened input 5.Called subprogram not found. S0C4 may be due to 1.Missing Select statement(during compile) 2.Bad Subscript/index 3.Protection Exception 4.Missing parameters on called subprogram 5.Read/Write to unopened file 6.Move data from/to unopened file.

S0C5 May be due to 1.Bad Subscript/index 2.Close an unopen dataset 3.Bad exit from a perform 4.Access to I/O area(FD) before read.

S0C7 may be due to 1.Numeric operation on non-numeric data 2.Un-initialize working-storage 3.Coding past the maximum allowed sub script. S0CB may be due to 1.Division by Zero

90. What will happen if you code GO BACK instead of STOP RUN in a stand-alone COBOL program i.e. a program which is not calling any other program.

Ans: Both give the same results when a program is not calling any other program.

91. What is the difference between an External and a Global Variable 's?

Ans:Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.

92. WHAT IS REPORT-ITEM?

Ans: A REPORT-item is a field to be printed that contains EDIT SYMBOLS

93. 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?

Ans: 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.

94. What is PSB & ACB?

Ans: 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.

95. What's a LDS(Linear Data Set) and what's it used for ?

Ans: 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.

96. What is the Importance of GLOBAL clause According to new standards of COBOL

Ans: 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.

97. What is the Purpose of POINTER Phrase in STRING command

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

98.How do we get currentdate from system with century?

Ans: By using Intrinsic function, FUNCTION CURRENT-DATE

99.what is the difference between search and search all in the table handling?

Ans: Search is a linear search and search all is a binary search.

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

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

No comments:

My Ad

.