Cobol常见面试题.doc
《Cobol常见面试题.doc》由会员分享,可在线阅读,更多相关《Cobol常见面试题.doc(23页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、有兴趣的好好看看.Q1) Name the divisions in a COBOL program ?. A1) IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION, PROCEDURE DIVISION.Q2) What are the different data types available in COBOL?A2) Alpha-numeric (X), alphabetic (A) and numeric (9).Q3) What does the INITIALIZE verb do? - GSA3) Alph
2、abetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric, Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.Q4) What is 77 level used for ?A4) Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they
3、be subdivided themselves.Q5) What is 88 level used for ?A5) For condition names.Q6) What is level 66 used for ?A6) For RENAMES clause.Q7) What does the IS NUMERIC clause establish ?A7) IS NUMERIC can be used on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed d
4、ecimal items. IS NUMERIC returns TRUE if the item only consists of 0-9. However, if the item being tested is a signed item, then it may contain 0-9, + and - .Q8) How do you define a table/array in COBOL?A8) ARRAYS.05 ARRAY1 PIC X(9) OCCURS 10 TIMES.05 ARRAY2 PIC X(6) OCCURS 20 TIMES INDEXED BY WS-IN
5、DEX.Q9) Can the OCCURS clause be at the 01 level?A9) No.Q10) What is the difference between index and subscript? - GSA10) Subscript refers to the array occurrence while index is the displacement (in no of bytes) from the beginning of the array. An index can only be modified using PERFORM, SEARCH & S
6、ET. Need to have index for a table in order to use SEARCH, SEARCH ALL.Q11) What is the difference between SEARCH and SEARCH ALL? - GSA11) SEARCH - is a serial search.SEARCH ALL - is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) b
7、efore using SEARCH ALL.Q12) What should be the sorting order for SEARCH ALL? - GSA12) It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You m
8、ust load the table in the specified order).Q13) What is binary search?A13) 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.Q14) My program has an a
9、rray defined to have 10 items. Due to a bug, I find that even if the program access the 11th item in this array, the program does not abend. What is wrong with it?A14) Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.Q15) How do you sort in a COBOL program? Gi
10、ve sort file definition, sort statement syntax and meaning. - GSA15) Syntax: SORT file-1 ON ASCENDING/DESCENDING KEY key. USING file-2 GIVING file-3.USING can be substituted by INPUT PROCEDURE IS para-1 THRU para-2GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.file-1 is the sort
11、 (work) file and must be described using SD entry in FILE SECTION.file-2 is the input file for the SORT and must be described using an FD entry in FILE SECTION and SELECT clause in FILE CONTROL. file-3 is the out file from the SORT and must be described using an FD entry in FILE SECTION and SELECT c
12、lause in FILE CONTROL.file-1, file-2 & file-3 should not be opened explicitly.INPUT PROCEDURE is executed before the sort and records must be RELEASEd to the sort work file from the input procedure.OUTPUT PROCEDURE is executed after all records have been sorted. Records from the sort work file must
13、be RETURNed one at a time to the output procedure.Q16) How do you define a sort file in JCL that runs the COBOL program?A16) Use the SORTWK01, SORTWK02,. dd names in the step. Number of sort datasets depends on the volume of data being sorted, but a minimum of 3 is required.Q17) What is the differen
14、ce between performing a SECTION and a PARAGRAPH? - GSA17) 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.Q18) What is the use of EVALUATE statement? - GSA18) Evaluate is like a ca
15、se 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.Q19) What are the different forms of EVALUATE statement?A19) EVALUATE EVALUATE SQLCODE ALSO FILE-
16、STATUSWHEN A=B AND C=D WHEN 100 ALSO 00imperative stmt imperative stmt WHEN (D+X)/Y = 4 WHEN -305 ALSO 32imperative stmt imperative stmtWHEN OTHER WHEN OTHERimperative stmt imperative stmtEND-EVALUATE END-EVALUATEEVALUATE SQLCODE ALSO A=B EVALUATE SQLCODE ALSO TRUEWHEN 100 ALSO TRUE WHEN 100 ALSO A=
17、Bimperative stmt imperative stmtWHEN -305 ALSO FALSE WHEN -305 ALSO (A/C=4)imperative stmt imperative stmtEND-EVALUATE END-EVALUATEQ20) How do you come out of an EVALUATE statement? - GSA20) After the execution of one of the when clauses, the control is automatically passed on to the next sentence a
18、fter the EVALUATE statement. There is no need of any extra code.Q21) In an EVALUATE statement, can I give a complex condition on a when clause?A21) Yes.Q22) What is a scope terminator? Give examples.A22) Scope terminator is used to mark the end of a verb e.g. EVALUATE, END-EVALUATE; IF, END-IF.Q23)
19、How do you do in-line PERFORM? - GSA23) PERFORM . <UNTIL> . <sentences>END-PERFORMQ24) When would you use in-line perform?A24) When the body of the perform will not be used in other paragraphs. If the body of the perform is a generic type of code (used from various other places in the pr
20、ogram), it would be better to put the code in a separate Para and use PERFORM Para name rather than in-line perform.Q25) What is the difference between CONTINUE & NEXT SENTENCE ?A25) They appear to be similar, that is, the control goes to the next sentence in the paragraph. But, Next Sentence would
21、take the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one if sentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0 then next sentence end if display line 1 display line 2.
22、 display line 3. * Note- there is a dot (.) only at the end of the last 2 statements, see the effect by replacing Next Sentence with Continue * Q26) What does EXIT do ?A26) Does nothing ! If used, must be the only sentence within a paragraph.Q27) Can I redefine an X(100) field with a field of X(200)
23、?A27) Yes. Redefines just causes both fields to start at the same location. For example:01 WS-TOP PIC X(1)01 WS-TOP-RED REDEFINES WS-TOP PIC X(2).If you MOVE 12 to WS-TOP-RED, DISPLAY WS-TOP will show 1 while DISPLAY WS-TOP-RED will show 12. A28) Can I redefine an X(200) field with a field of X(100)
24、 ?Q31)1 Yes.Q31)2 What do you do to resolve SOC-7 error? - GSQ31) Basically you need to correcting the offending data. Many times the reason for SOC7 is an un-initialized numeric item. Examine that possibility first. Many installations provide you a dump for run time abends ( it can be generated als
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Cobol 常见 试题
限制150内