cobol常见的面试题

更新时间:2023-05-19 06:47:27 阅读: 评论:0

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? - GS
A3) Alphabetic, Alphanumeric fields & alphanumeric edited items are t to SPACES. Numeric, Numeric edited items t to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.
Q4) What is 77 level ud for ?
A4) Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can they be subdivided themlves.
Q5) What is 88 level ud for ?
A5) For condition names.
Q6) What is level 66 ud for ?
A6) For RENAMES clau.
Q7) What does the IS NUMERIC clau establish ?
A7) IS NUMERIC can be ud on alphanumeric items, signed numeric & packed decimal items and unsigned numeric & packed decimal 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-INDEX.
Q9) Can the OCCURS clau be at the 01 level?
A9) No.
Q10) What is the difference between index and subscript? - GS
A10) 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 & SET. Need to have index for a table in order to
u SEARCH, SEARCH ALL.
Q11) What is the difference between SEARCH and SEARCH ALL? - GS
A11) SEARCH - is a rial arch.
广告法禁用词汇SEARCH ALL - is a binary arch & the table must be sorted ( ASCENDING/DESCENDING KEY clau to be ud & data loaded in this order) before using SEARCH ALL.
Q12) What should be the sorting order for SEARCH ALL? - GS
A12) It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the arch to be done on an 喜欢你藏语版
array sorted in descending order, then while defining the array, you should give DESCENDING KEY clau. (You
must load the table in the specified order).
Q13) What is binary arch?
A13) Search on a sorted array. Compare the item to be arched with the item at the center. If it matches, fine el repeat the process with the left half or the right half depending on where the item lies.
Q14) My program has an array 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 u compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE.
Q15) How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. - GS
A15) Syntax: SORT file-1 ON ASCENDING/DESCENDING USING file-2 GIVING file-3.
USING can be substituted by INPUT PROCEDURE IS para
-1 THRU para-2
GIVING can be substituted by OUTPUT PROCEDURE IS para-1 THRU para-2.
file-1 is the sort (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
clau 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
clau 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 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) U the SORTWK01, SORTWK02,..... dd names in the step. Number of sort datats depends on the volume of data
being sorted, but a minimum of 3 is required.
Q17) What is the difference between performing a SECTION and a PARAGRAPH? - GS
A17) Performing a SECTION will cau all the paragraphs that are part of the ction, to be performed.
Performing a PARAGRAPH will cau only that paragraph to be performed.
Q18) What is the u of EVALUATE statement? - GS
A18) Evaluate is like a ca statement and can be ud to replace nested Ifs. The difference between EVALUATE and
ca is that no 'break' is required for 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-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 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
内蒙烤全羊
Q20) How do you come out of an EVALUATE statement? - GS
A20) After the execution of one of the when claus, the control is automatically pasd on to the next ntence after 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 clau?
A21) Yes.
Q22) What is a scope terminator? Give examples.
A22) Scope terminator is ud to mark the end of a EVALUATE, END-EVALUATE; IF, END-IF.
Q23) How do you do in-line PERFORM? - GS
精神病症状
A23) PERFORM ... <UNTIL> ... 如何生成目录
<ntences>
END-PERFORM
Q24) When would you u in-line perform?
A24) When the body of the perform will not be ud in other paragraphs. If the body of the perform is a generic type of code
(ud from various other places in the program), it would be better to put the code in a parate Para an
d u
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 ntence in the paragraph. But, Next Sentence would
take the control to the ntence after it finds a full stop (.). Check out by writing the following code example, one if
ntence followed by 3 display statements (sorry they appear one line here becau of formatting restrictions) If 1 > 0
then next ntence end if display 'line 1' display 'line 2'. display 'line 3'. *** Note- there is a dot (.) only at the end of
the last 2 statements, e the effect by replacing Next Sentence with Continue ***
Q26) What does EXIT do ?
A26) Does nothing ! If ud, must be the only ntence within a paragraph.
Q27) Can I redefine an X(100) field with a field of X(200)?
二十元钱A27) Yes. Redefines just caus 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) ?
Q31)1 Yes.
Q31)2 What do you do to resolve SOC-7 error? - GS
Q31) 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 abend’s ( it can be generated also
by calling some subroutines or OS rvices thru asmbly language). The dumps provide the offt of the last
instruction at which the abend occurred. Examine the compilation output XREF listing to get the verb and the line
number of the source code at this offt. Then you can look at the source code to find the bug. To get capture the
runtime dumps, you will have to define some datats (SYSABOUT etc ) in the JCL. If none of the are helpful, u
judgement and DISPLAY to localize the source of error. Some installation might have batch program debugging
tools. U them.

本文发布于:2023-05-19 06:47:27,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/691347.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:词汇   烤全羊   精神病   目录   禁用   内蒙   症状
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图