没有合适的资源?快使用搜索试试~ 我知道了~
首页COBOL面试经典题集
资源详情
资源评论
资源推荐
Q1) Name the divisions in a COBOL program ?.
A1) IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION,
PROCEDURE DIVISION.
Q:列举 COBOL 的 DEVISION
A:标识部,环境部,数据部,过程部
Q2) What are the different data types available in COBOL?
A2) Alpha-numeric (X), alphabetic (A) and numeric (9).
Q:COBOL 有哪些可用的数据类型
A:字符型(这里指的是包含字母和数字),字母型,数字型
Q3) What does the INITIALIZE verb do? - GS
A3) Alphabetic, Alphanumeric fields & alphanumeric edited items are set to SPACES. Numeric,
Numeric edited items set to ZERO. FILLER , OCCURS DEPENDING ON items left untouched.
Q:INITIALIZE 这个词做了些什么
A:将字母,字符,数字区域都置成空格(置空),将数字区置 0, FILLER 和 OCCURS
DEPENDING ON 项不处理
Q4) What is 77 level used for ?
A4) Elementary level item. Cannot be subdivisions of other items (cannot be qualified), nor can
they be subdivided themselves.
Q:77 层有什么作用
A:基本层数据项,不能用做细分别的层,也不能被细分
Q5) What is 88 level used for ?
A5) For condition names.
Q:88 层有什么作用
A:条件逻辑层
Q6) What is level 66 used for ?
A6) For RENAMES clause.
Q:66 层有什么作用
A:重命名层
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 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
- .
Q:IS NUMERIC 这个子句怎么确定(也就是说确定句子的真值)
A:IS NUMERIC 用在字符项,带符号数字,浮点数,不带符号数。如果目标项只含 0~9
则返回 TRUE。但是,如果待测项目是个带符号数,那么他就含有 0-9 还有+和-
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
Q:COBOL 中怎么建表/数组
A:如上.
Q9) Can the OCCURS clause be at the 01 level?
A9) No.
Q:OCCURS 子句能用在第一层吗
A:不能
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
use SEARCH, SEARCH ALL.
Q:索引和下标有什么区别
A:下标可以指定数组中任意中位置的元素(只要知道其下标),下标只能是数字型常量
或者数字型变量(但是不能在指定的时候修改,如:A(K+1)这样是不行的,要修改的话
要在指定的外部改,如:ADD 1 TO K,而索引的话是从表头/数组头开始检索(以 BY N 的
指定检索规律往后滚)
再 者 , 索引只能 通 过 PERFORM, SEARCH 和 SET 来 修 改 , 如 果 要 在 一 个 表 中 使 用
SEARCH, SEARCH ALL,那这个表就要有索引(因为 SEARCH, SEARCH ALL 的参数中指
定索引,所以即使其有很多限制还是得用它)
Q11) What is the difference between SEARCH and SEARCH ALL? - GS
A11) 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) before using SEARCH ALL.
Q:SERACH 和 SERACH ALL 有什么区别
A:SEARCH 是顺序查找
SERACH ALL 是 2 叉查找(相信数据结构学过 2 叉树的都不会陌生),在使用 SEARCH
ALL 前表必须有一个递增/递减的 KEY,并且表已经按照其 KEY 值排序了,这样才能使用
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
search to be done on an
array sorted in descending order, then while defining the array, you should give DESCENDING
KEY clause. (You
must load the table in the specified order).
Q:为了使用 SEARCH ALL,存贮顺序是怎么样的
A:他必须是递增或者是递减的,默认地政。如果你想在一个递减顺序存贮的表/数组使用
搜索的话,那么当定义表/数组的时候你应该加一个 DESCENDING KEY 子句(这之前表要
已经按指定的顺序排序了)
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.
Q:什么是 2 叉查找
A:将你要找的目标项与数组的正中项比较,找到就结束搜索,没找到则继续如此循环
(比较下一个中值),取哪一半取决于目标值大于中值还是小于中值
PS:联想 2 叉树的查找规律就很好理解,因为所谓的“表“本身也就是数组
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 use compiler option SSRANGE if you want array bounds checking. Default is
NOSSRANGE.
Q:我的程序有个数组定义了 10 项。因为有个 BUG,我发现即使访问第 11 项,程序也不
异常终止。那是出了什么问题
A:必须使用编译器的一个选项 SSRANGE ,如果你想检查数组的超界问题。默认是
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 KEY key…. 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
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
clause 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.
Q:怎么在一个 COBOL 程序中排序?给出排序文件的定义,排序语法和意思
A : 语 法 就 是 SORT file-1 ON ASCENDING/DESCENDING KEY key…. USING file-2
GIVING file-3.
USING 后程序的输入接口,这个地方可以替换成一个输出过程,也就是说写一个过程往
USING 这个接口中导数据(要在这个过程中 READ,AT END,……),这个过程在将数
据释放到执行排序的文件中之前执行,GIVING 后是输出借口,用法类似。
此例中输入文件是 file-2 输出文件是 file3(这样个文件必须在文件区中用 FD 和在文件控制
中用到 SELECT)真正执行排序的 file-1,这里需要注意的是 file-1 中的文件区不能用 FD,
应该用 SD,file-2 和 3 还是一样(用 FD),具体可以看一下书上的例子
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.
Q:怎么在 JCL 中定义一个排序文件来跑这个 COBOL 程序
A:用 SORTWK01, SORTWK02,…..作为 DATA SET NAME。用多少取决于你要排序的数量,
但是至少 3 个。
Q17) What is the difference between performing a SECTION and a PARAGRAPH? - GS
A17) 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.
Q:执行一个区和一个段有什么区别
A:简单来说的话就是区的概念比段大,执行一个区就要执行其内部所有段,执行段的话
只执行该段。
Q18) What is the use of EVALUATE statement? - GS
A18) Evaluate is like a case 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.
Q:EVALUATE 语句有什么作用
A:EVALUATE 就象个 CASE 语句(多重开关语句,学过 C 的总知道吧),不同点在于
EVALUATE 不需要 BREAK,一旦匹配就跳出 EVALUATE 语句了
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 clauses, the control is automatically passed on to the
next sentence after the
EVALUATE statement. There is no need of any extra code.
Q:怎么跳出一条 EVALUATE 语句
A:象 18 题目说的那样,一旦匹配了某一个“WHEN“语句就自动跳出了,不需要什么额外
的代码来跳出
Q21) In an EVALUATE statement, can I give a complex condition on a when clause?
A21) Yes.
Q:在一个 EVALUATE 语句的某个 WHEN 分支中能否再插入复杂的情况(也就是嵌套)
A:当然可以,当多个参数作为控制变量的时候 1 个 WHEN 内部可以嵌套更多的情况
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.
Q:什么是结束终止符
A : 结 束 终 止 符 是 搭 配 一 些 范 围 指 令 的 , 也 就 是 标 识 一 些 范 围 指 令 的 结 束 。 如:
EVALUATE, END-EVALUATE; IF, END-IF 如果没有该结束符,该条语句将终止不了
Q23) How do you do in-line PERFORM? - GS
A23) PERFORM … …
END-PERFORM
Q:怎么使用内嵌的 PERFORM
A:PERFORM … …
END-PERFORM
所谓内嵌也就是 PERFORM 被嵌在某些比如循环语句中担当执行主体,同时通过 UNTIL 来
指定结束判定
Q24) 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 program), it would be better to put the code in a separate
剩余27页未读,继续阅读
xcscobol
- 粉丝: 3
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- stc12c5a60s2 例程
- Android通过全局变量传递数据
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论2