COBOL语言测试试卷(一)

合集下载

日语版cobol笔试题

日语版cobol笔试题

COBOL试题一、下記の質問の通り、正しい結果を選らんでください。

(7X2分)1、PIC 9(3) COMP-3は何バイトを占めますか?( A )A、2バイトB、3バイトC、6バイト2、PIC 9(2)V99は何バイトを占めますか?( B )A、2バイトB、4バイトC、5バイト3、下記の項目の定義は正しいの数はどのですか。

( A )① 01 NA-2 PIC X(8).② 01 NB-2 PIC V99.③ 01 NC-2 PIC S9(2).④ 01 ND-2 PIC SX(4).⑤ 01 NE 2 PIC P99.A、1,2,3B、1,2,5C、2,3,44、A ** 2 * B / 2 + C – 5の優先順番はどのですか。

()A、(((A ** 2) * B) / 2) + C – 5B、((A ** 2) * (B / 2)) + C – 5C、((A ** (2 * B)) / 2) + C – 55、下記のマークはCOBOLに使えません。

( B )A、-B、*C、#6、ジョブは、いくつかのロケーションパラメータを持つことができます。

()A、1B、2C、37、ジョブは、いくつかのジョブステップを持つことができます。

()A、225B、255C、15二、解答してください。

(17X3分)1、COBOLの構成部分(DIVISIONS)の名前。

IDENTIFICATION DIVISIONENVIRONMENT DIVISIONDATA DIVISIONPROCEDURE DIVISION2、プログラムにFILE-CONTROLはどの部分に定業される。

ENVIRONMENT DIVISION3、データ定義する時、A型とX型の区別。

A型定义的数字型X型定义的是字母型4、IF A NOT > 0 AND B=2 のケースを書いてください。

5、COBOLの中に66階がどこかを使います。

重定义层6、COBOLの中に77階がどこかを使います。

COBOL-练习题

COBOL-练习题

要求:请将练习题的代码(屏幕上必须含有USERID)、返回码、实现的结果进行截图,粘贴到每道题目的下边,全部题目完成后回传给授课教师。

1.参照书中的例子,编写自己的第一个程序,显示一行信息:Hello COBOL!2.编写一个程序,实现以下功能:a)定义一个组合变量,如下:INITIALIZE01TEST-DA TA-1.05 TEST-9999 PIC 9(04).05 TEST-XXX PIC X(03).05 TEST-AAA PIC A(03).b)使用INITIALIZE语句对TEST-DATA-1进行初始化c)分别显示TEST-DA TA-1、TEST-9999、TEST-XXX、TEST-AAA3.编写一个程序,实现以下功能:4.编写一个程序,实现以下功能:a)使用ACCEPT语句接收系统时间day of weekb)判断并输出今天是星期几(如:TODAY IS SUNDAY)5.编写一个程序,实现以下功能:a)使用ACCEPT语句接收一个数值:20121221b)按如下格式显示该数值:END OF THE WORLD:Year: 2012Month: 12Day: 216.编写一个程序,使用MOVE语句,实现以下功能:a)字符型不同长度变量之间的赋值,并显示赋值结果。

b)数值型不同长度变量之间的赋值,并显示赋值结果。

c)数值型向变量字符型变量赋值,并显示赋值结果。

d)字符型向变量数值型变量赋值,并显示赋值结果。

e)初等项与组合项变量之间的赋值,并显示赋值结果。

f)组合项与组合项变量之间的赋值,并显示赋值结果。

7.编写一个程序,实现以下功能:a)b)当FLG = ‘A’时,计算并显示DATA-1 + DATA-2的值当FLG = ‘S’时,计算并显示DATA-1 - DATA-2的值当FLG = ‘M’时,计算并显示DATA-1 * DATA-2的值当FLG = ‘D’时,计算并显示DATA-1 / DATA-2的值8.使用IF语句完成第7题。

cobol面试题

cobol面试题

cobol面试题在计算机编程领域中,COBOL(全称为COmmon Business-Oriented Language)是一种广泛使用的高级编程语言,特别适合用于处理商业数据处理应用。

COBOL于1959年首次发布,并成为企业级应用的主要编程语言之一。

COBOL具有可读性强、易于维护和横向扩展的特点,至今仍广泛应用于金融、保险、银行等行业。

本文将为您介绍一些常见的COBOL面试题,帮助您准备面试并提高成功率。

以下是一些常见的COBOL面试题,供您参考:1. COBOL编程语言的特点是什么?COBOL编程语言具有以下特点:- 可读性强:COBOL使用英语类似的语法和词汇,代码易于理解和维护。

- 商业导向:COBOL专为商业应用程序设计,具有处理大量数据和复杂逻辑的能力。

- 文件处理:COBOL在文件处理方面非常强大,能够处理大型数据集和复杂文件结构。

- 面向记录:COBOL是一种面向数据记录的编程语言,适用于处理各种类型的记录和数据结构。

2. COBOL的数据类型有哪些?COBOL支持多种数据类型,包括:- Numeric:数值类型,包括整数(如INTEGER、COMP-3)和浮点数(如FLOAT、PACKED-DECIMAL)。

- Alphabetic:字母类型,用于处理字符和字符串数据。

- Alphanumeric:字母数字类型,包括字母、数字和特殊字符。

- DBCS(Double-Byte Character Set):双字节字符集类型,用于处理多字节字符,如中文、日文等。

3. COBOL中的文件处理方式有哪些?COBOL提供了以下文件处理方式:- Sequential:顺序文件处理,按照文件记录的顺序逐条读取和写入数据。

- Indexed:索引文件处理,使用索引键值进行数据的读取和写入。

- Relative:相对文件处理,根据记录的相对位置进行数据的读取和写入。

- Dynamic:动态文件处理,可以根据程序运行时的需求动态打开、关闭和访问文件。

cobol 面试题

cobol 面试题

cobol 面试题COBOL面试题COBOL(Common Business Oriented Language)是一种广泛应用于商业和金融领域的编程语言。

对于招聘COBOL开发人员的公司来说,面试是选拔合适候选人的重要环节。

本文将为您提供一些常见的COBOL面试题,以帮助您准备和了解COBOL编程语言。

1. COBOL中如何声明一个变量?在COBOL中,可以使用“01”关键字来声明一个变量,示例如下:01 CUSTOMER-INFO.05 CUSTOMER-NAME PIC X(20).05 CUSTOMER-AGE PIC 99.05 CUSTOMER-ADDRESS PIC X(50).2. COBOL中如何进行文件读取操作?COBOL提供了READ语句用于读取文件中的数据记录。

以下是一个示例:READ FILE-NAME INTO RECORD-NAME.3. COBOL中如何进行条件判断?COBOL使用IF语句来进行条件判断。

下面是一个简单的例子:IF TOTAL-SALES > 10000DISPLAY "High sales!"ELSEDISPLAY "Low sales!"END-IF.4. COBOL中如何进行循环操作?COBOL中的循环语句包括PERFORM和GO TO语句。

下面是一个使用PERFORM的例子:PERFORM UNTIL COUNTER > 10ADD 1 TO COUNTERDISPLAY COUNTEREND-PERFORM.5. COBOL中如何处理异常?COBOL使用异常处理块来处理异常情况。

以下是一个TRY...ON...END TRY结构的例子:TRYDIVIDE NUM1 BY NUM2 GIVING RESULT.ON EXCEPTIONDISPLAY "Error: Division by zero."END TRY.6. COBOL中如何进行字符串操作?COBOL提供了一系列用于字符串操作的函数和语句。

COBOL面试1—30题

COBOL面试1—30题

Q1) Name the divisions in a COBOL program ?.Q2) What are the different data types available in COBOL?Q3) What does the INITIALIZE verb do? - GSQ4) What is 77 level used for ?Q5) What is 88 level used for ?Q6) What is level 66 used for ?Q7) What does the IS NUMERIC clause establish ?Q8) How do you define a table/array in COBOL?Q9) Can the OCCURS clause be at the 01 level?Q10) What is the difference between index and subscript? - GSQ11) What is the difference between SEARCH and SEARCH ALL? - GSQ12) What should be the sorting order for SEARCH ALL? - GSQ13) What is binary search?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?Q15) How do you sort in a COBOL program? Give sort file definition, sort statement syntax and meaning. - GSQ16) How do you define a sort file in JCL that runs the COBOL program?Q17) What is the difference between performing a SECTION and a PARAGRAPH? - GSQ18) What is the use of EV ALUATE statement? - GSQ19) What are the different forms of EV ALUATE statement?Q20) How do you come out of an EV ALUA TE statement? - GSQ21) In an EVALUA TE statement, can I give a complex condition on a when clause?Q22) What is a scope terminator? Give examples.Q23) How do you do in-line PERFORM? - GSQ24) When would you use in-line perform?Q25) What is the difference between CONTINUE & NEXT SENTENCE ?Q26) What does EXIT do ?Q27) Can I redefine an X(100) field with a field of X(200)?Q28) Can I redefine an X(200) field with a field of X(100) ?Q31)2 What do you do to resolve SOC-7 error? - GSQ32) How is sign stored in Packed Decimal fields and Zoned Decimal fields?Q33) How is sign stored in a comp-3 field? - GSQ34) How is sign stored in a COMP field ? - GSQ35) What is the difference between COMP & COMP-3 ?Q36) What is COMP-1? COMP-2?Q37) How do you define a variable of COMP-1? COMP-2?Q38) How many bytes does a S9(7) COMP-3 field occupy ?Q39) How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ? Q40) How many bytes will a S9(8) COMP field occupy ?Q41) What is the maximum value that can be stored in S9(8) COMP?Q42) What is COMP SYNC?Q43) What is the maximum size of a 01 level item in COBOL I? in COBOL II? Q44) How do you reference the following file formats from COBOL programs:Q45) What are different file OPEN modes available in COBOL?Q46) What is the mode in which you will OPEN a file for writing? - GSQ47) In the JCL, how do you define the files referred to in a subroutine?Q48) Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?Q49) What is file status 92? – GSQ50) What is file status 39 ?Q51) What is Static and Dynamic linking ?Q52) What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)? (applicable to only MVS/ESA Enterprise Server).。

Cobol常见面试题

Cobol常见面试题

有兴趣的好好看看.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) Alphabetic, 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 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 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 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 thearray. An index can only be modified using PERFORM, SEARCH & SET. Need to have index for a table in order touse 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) before 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 anarray sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (Youmust 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 array defined to have 10 items. Due to a bug, I find that even if the program access the11th 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? 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-2GIVING 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.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 databeing sorted, but a minimum of 3 is required.Q17) What is the difference 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 case statement and can be used to replace nested Ifs. The difference between EVALUATE andcase is that no 'break' is required for EVALUATE i.e. control comes out of the EVALUATE as soon as one match ismade.Q19) What are the different forms of EVALUATE statement?A19)EVALUATE EVALUATE SQLCODE ALSO FILE-STATUSWHEN A=B AND C=D WHEN 100 ALSO '00'imperative stmt imperative stmtWHEN (D+X)/Y = 4 WHEN -305 ALSO '32'imperative 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=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 after theEVALUATE 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) 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 program), 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 wouldtake the control to the sentence after it finds a full stop (.). Check out by writing the following code example, one ifsentence followed by 3 display statements (sorry they appear one line here because of formatting restrictions) If 1 > 0then next sentence end if display 'line 1' display 'line 2'. display 'line 3'. *** Note- there is a dot (.) only at the end ofthe 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)?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 whileDISPLAY 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? - 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 abend’s ( it can be generated alsoby calling some subroutines or OS services thru assembly language). These dumps provide the offset of the lastinstruction at which the abend occurred. Examine the compilation output XREF listing to get the verb and the linenumber of the source code at this offset. Then you can look at the source code to find the bug. To get capture theruntime dumps, you will have to define some datasets (SYSABOUT etc ) in the JCL. If none of these are helpful, usejudgement and DISPLAY to localize the source of error. Some installation might have batch program debuggingtools. Use them.Q32) How is sign stored in Packed Decimal fields and Zoned Decimal fields?Q32) Packed Decimal fields: Sign is stored as a hex value in the last nibble (4 bits ) of the storage.Zoned Decimal fields: As a default, sign is over punched with the numeric value stored in the last bite.Q33) How is sign stored in a comp-3 field? - GSQ33) It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C ifyour number is 101, hex 2C if your number is 102, hex 1D if the number is -101, hex 2D if the number is -102 etc...Q34) How is sign stored in a COMP field ? - GSQ34) In the most significant bit. Bit is ON if -ve, OFF if +ve.Q35) What is the difference between COMP & COMP-3 ?Q35) COMP is a binary storage format while COMP-3 is packed decimal format.Q36) What is COMP-1? COMP-2?Q36) COMP-1 - Single precision floating point. Uses 4 bytes.COMP-2 - Double precision floating point. Uses 8 bytes.Q37) How do you define a variable of COMP-1? COMP-2?Q37) No picture clause to be given. Example 01 WS-VAR USAGE COMP-1.Q38) How many bytes does a S9(7) COMP-3 field occupy ?Q38) Will take 4 bytes. Sign is stored as hex value in the last nibble. General formula is INT((n/2) + 1)), where n=7 in thisexample.Q39) How many bytes does a S9(7) SIGN TRAILING SEPARATE field occupy ?Q39) Will occupy 8 bytes (one extra byte for sign).Q40) How many bytes will a S9(8) COMP field occupy ?Q40) 4 bytes.Q41) What is the maximum value that can be stored in S9(8) COMP?Q41) 99999999Q42) What is COMP SYNC?Q42) Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT. For binary dataitems, the address resolution is faster if they are located at word boundaries in the memory. For example, on mainframe the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If myfirst variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will startfrom byte 3 ( assuming that it starts from 0 ). If you specify SYNC, then the binary data item will start from address 4.You might see some wastage of memory, but the access to this computational field is faster.Q43) What is the maximum size of a 01 level item in COBOL I? in COBOL II?Q43) In COBOL II: 16777215Q44) How do you reference the following file formats from COBOL programs:Q44)Fixed Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F,BLOCK CONTAINS 0 .Fixed Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F,do not use BLOCK CONTAINSVariable Block File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, BLOCK CONTAINS 0. Do not code the 4 bytes for record length in FD ie JCL rec length will be max rec length in pgm + 4Variable Unblocked - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS V, do not use BLOCK CONTAINS. Do not code 4 bytes for record length in FD ie JCL rec length willbe max rec length in pgm + 4.ESDS VSAM file - Use ORGANISATION IS SEQUENTIAL.KSDS VSAM file - Use ORGANISATION IS INDEXED, RECORD KEY IS, ALTERNATE RECORD KEY IS RRDS File - Use ORGANISATION IS RELATIVE, RELATIVE KEY ISPrinter File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCKCONTAINS 0. (Use RECFM=FBA in JCL DCB).Q45) What are different file OPEN modes available in COBOL?Q45) Open for INPUT, OUTPUT, I-O, EXTEND.Q46) What is the mode in which you will OPEN a file for writing? - GSQ46) OUTPUT, EXTENDQ47) In the JCL, how do you define the files referred to in a subroutine ?Q47) Supply the DD cards just as you would for files referred to in the main program.Q48) Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?Q48) Can rewrite (record length must be same), but not delete.Q49) What is file status 92? - GSQ49) Logic error. e.g., a file is opened for input and an attempt is made to write to it.Q50) What is file status 39 ?Q50) Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). Youwill get file status 39 on an OPEN.Q51) What is Static and Dynamic linking ?Q51) In static linking, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine & the main program will exist as separate load modules. You choose static/dynamic linking by choosing either the DYNAM or NODYNAM link edit option. (Even if you choose NODYNAM, a CALL identifier (as opposed to a CALL literal), will translate to a DYNAMIC call).A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state.Q52) What is AMODE(24), AMODE(31), RMODE(24) and RMODE(ANY)? (applicable to only MVS/ESA Enterprise Server).Q52) These are compile/link edit options. Basically AMODE stands for Addressing mode and RMODE for Residencymode.AMODE(24) - 24 bit addressing;AMODE(31) - 31 bit addressingAMODE(ANY) - Either 24 bit or 31 bit addressing depending on RMODE.RMODE(24) - Resides in virtual storage below 16 Meg line. Use this for 31 bit programs that call 24 bit programs.(OS/VS Cobol pgms use 24 bit addresses only).RMODE(ANY) - Can reside above or below 16 Meg line.Q53) What compiler option would you use for dynamic linking?Q53) DYNAM.Q54) What is SSRANGE, NOSSRANGE ?Q54) These are compiler options with respect to subscript out of range checking. NOSSRANGE is the default and if chosen,no run time error will be flagged if your index or subscript goes out of the permissible range.Q55) How do you set a return code to the JCL from a COBOL program?Q55) Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.Q56) How can you submit a job from COBOL programs?Q56) Write JCL cards to a dataset with //xxxxxxx SYSOUT= (A,INTRDR) where 'A' is output class, and dataset should beopened for output in the program. Define a 80 byte record layout for the file.Q57) What are the differences between OS VS COBOL and VS COBOL II?Q57) OS/VS Cobol pgms can only run in 24 bit addressing mode, VS Cobol II pgms can run either in 24 bit or 31 bitaddressing modes.I. Report writer is supported only in OS/VS Cobol.II. USAGE IS POINTER is supported only in VS COBOL II.III. Reference modification e.g.: WS-VAR(1:2) is supported only in VS COBOL II.IV. EVALUATE is supported only in VS COBOL II.V. Scope terminators are supported only in VS COBOL II.VI. OS/VS Cobol follows ANSI 74 stds while VS COBOL II follows ANSI 85 stds.VII. Under CICS Calls between VS COBOL II programs are supported.Q58) What are the steps you go through while creating a COBOL program executable?Q58) DB2 precompiler (if embedded SQL used), CICS translator (if CICS pgm), Cobol compiler, Link editor. If DB2program, create plan by binding the DBRMs.Q59) Can you call an OS VS COBOL pgm from a VS COBOL II pgm ?Q59) In non-CICS environment, it is possible. In CICS, this is not possible.Q60) What are the differences between COBOL and COBOL II?A60) There are at least five differences:COBOL II supports structured programming by using in line Performs and explicit scope terminators, It introducesnew features (EVALUATE, SET. TO TRUE, CALL. BY CONTEXT, etc) It permits programs to be loaded and addressed above the 16-megabyte line It does not support many old features (READY TRACE,REPORT-WRITER,ISAM, Etc.), and It offers enhanced CICS support.Q61) What is an explicit scope terminator?A61) A scope terminator brackets its preceding verb, e.g. IF .. END-IF, so that all statements between the verb and its scope terminator are grouped together. Other common COBOL II verbs are READ, PERFORM, EVALUATE, SEARCH and STRING.Q62) What is an in line PERFORM? When would you use it? Anything else to say about it?A62) The PERFORM and END-PERFORM statements bracket all COBOL II statements between them. The COBOL equivalent is to PERFORM or PERFORM THRU a paragraph. In line PERFORMs work as long as there are no internal GO TOs, not even to an exit. The in line PERFORM for readability should not exceed a page length - often it will reference other PERFORM paragraphs.Q63) What is the difference between NEXT SENTENCE and CONTINUE?A63) NEXT SENTENCE gives control to the verb following the next period. CONTINUE gives control to the next verb after the explicit scope terminator. (This is not one of COBOL II's finer implementations). It's safest to use CONTINUE rather than NEXT SENTENCE in COBOL II.Q64) What COBOL construct is the COBOL II EVALUATE meant to replace?A64) EVALUATE can be used in place of the nested IF THEN ELSE statements.Q65) What is the significance of 'above the line' and 'below the line'?A65) 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 keptunder 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.)Q66) What was removed from COBOL in the COBOL II implementation?A66) Partial list: REMARKS, NOMINAL KEY, PAGE-COUNTER, CURRENT-DAY, TIME-OF-DAY, STATE, FLOW, COUNT, EXAMINE, EXHIBIT, READY TRACE and RESET TRACE.Q67) Explain call by context by comparing it to other calls.A67) 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.Q68) What is the linkage section?A68) The linkage section is part of a called program that 'links' or maps to data items in the calling program's working storage. It is the part of the called program where these share items are defined.Q69) What is the difference between a subscript and an index in a table definition?A69) A subscript is a working storage data definition item, typically a PIC (999) where a value must be moved to the subscript and then incremented or decrements by ADD TO and SUBTRACT FROM statements. An index is a register item that exists outside the program's working storage. You SET an index to a value and SET it UP BY value and DOWN BY value.Q70) If you were passing a table via linkage, which is preferable - a subscript or an index?A70) Wake up - you haven't been paying attention! It's not possible to pass an index via linkage. The index is not part of the calling programs working storage. Those of us who've made this mistake, appreciate the lesson more than others.Q71) Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc.A71) An external sort is not COBOL; it is performed through JCL and PGM=SORT. It is understandable without an y code reference. An internal sort can use two different syntax’s: 1.) USING, GIVING sorts are comparable to external sorts with no extra file processing; 2) INPUT PROCEDURE, OUTPUT PROCEDURE sorts allow for data manipulation before and/or after the sort.Q72) What is the difference between comp and comp-3 usage? Explain other COBOL usage’s.A72) Comp is a binary usage, while comp-3 indicates packed decimal. The other common usage’s are binary and display. Display is the default.Q73) When is a scope terminator mandatory?A73) Scope terminators are mandatory for in-line PERFORMS and EVALUATE statements. For readability, it's recommended coding practice to always make scope terminators explicit.Q74) In a COBOL II PERFORM statement, when is the conditional tested, before or after the perform execution?A74) In COBOL II the optional clause WITH TEST BEFORE or WITH TEST AFTER can be added to all perform statements. By default the test is performed before the perform.A75) Absolutely. Evaluation of the WHEN clauses proceeds from top to bottom and their sequence can determine results.Q76) What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default.A76) INITIALIZE moves spaces to alphabetic fields and zeros to alphanumeric fields. The REPLACING option can be used to override these defaults.Q77) What is SET TO TRUE all about, anyway?A77) In COBOL II the 88 levels can be set rather than moving their associated values to the related data item. (Web note: This change is not one of COBOL II's better specifications.)Q78) What is LENGTH in COBOL II?A78) LENGTH acts like a special register to tell the length of a group or elementary item.Q79) What is the difference between a binary search and a sequential search? What are the pertinent COBOL commands?A79) In a binary search the table element key values must be in ascending or descending sequence. The table is 'halved' to search for equal to, greater than or less than conditions until the element is found. In a sequential search the table is searched from top to bottom, so (ironically) the elements do not have to be in a specific sequence. The binary search is much faster for larger tables, while sequential works well with smaller ones. SEARCH ALL is used for binary searches; SEARCH for sequential.Q80) What is the point of the REPLACING option of a copy statement?A80) REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.Q81) 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.A81) The program will go in an infinite loop.Q82) How can I tell if a module is being called DYNAMICALLY or STATICALLY?A82) The ONLY way is to look at the output of the linkage editor (IEWL)or the load module itself. If the module is being called DYNAMICALLY then it will not exist in the main module, if it is being called STATICALLY then it will be seen in the load module. Calling a working storage variable, containing a program name, does not make a DYNAMIC call. This type of calling is known as IMPLICITE calling as the name of the module is implied by the contents of the working storage variable. Calling a program name literal (CALLQ83) What is the difference between a DYNAMIC and STATIC call in COBOL.A83) To correct an earlier answer: All called modules cannot run standalone if they require program variables passed to them via the LINKAGE section. DYNAMICally called modules are those that are not bound with the calling program at link edit time (IEWL for IBM) and so are loaded from the program library (joblib or steplib) associated with the job. For DYNAMIC calling of a module the DYNAM compiler option must be chosen, else the linkage editor will not generate an executable as it will expect u address resolution of all called modules. A STATICally called module is one that is bound with the calling module at link edit, and therefore becomes part of the executable load module.Q84) How may divisions are there in JCL-COBOL?Q85) What is the purpose of Identification Division?A85) Documentation.Q86) What is the difference between PIC 9.99 and 9v99?A86) PIC 9.99 is a FOUR-POSITION field that actually contains a decimal point where as PIC 9v99 is THREE- POSITION numeric field with implied or assumed decimal position.Q87) what is Pic 9v99 Indicates?A87) PICTURE 9v99 is a three position Numeric field with an implied or assumed decimal point after the first position; the v means an implied decimal point.Q88) What guidelines should be followed to write a structured Cobol prg'm?A88)1) use 'evaluate' stmt for constructing cases.2) use scope terminators for nesting.3) use in line perform stmt for writing 'do ' constructions.4) use test before and test after in the perform stmt for writing do-while constructions.Q89) Read the following code. 01 ws-n pic 9(2) value zero. a-para move 5 to ws-n. perform b-para ws-n times. b-para.move 10 to ws-n. how many times will b-para be executed ?A89) 5 times only. it will not take the value 10 that is initialized in the loop.Q90) What is the difference between SEARCH and SEARCH ALL? What is more efficient?A90) SEARCH is a sequential search from the beginning of the table. SEARCH ALL is a binary search, continually dividing the table in two halves until a match is found. SEARCH ALL is more efficient for tables larger than 70 items.Q91) What are some examples of command terminators?A91) END-IF, END-EVALUATEQ92) What care has to be taken to force program to execute above 16 Meg line?A92) Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never haveSIZE(MAX). BUFSIZE can be 2K, efficient enough.Q93) How do you submit JCL via a Cobol program?A93) Use a file //dd1 DD sysout=(*, intrdr)write your JCL to this file. Pl some on try this out.Q94) How to execute a set of JCL statements from a COBOL programA94) Using EXEC CICS SPOOL WRITE(var-name) END-EXEC command. var-name is a COBOL host structure containing JCL statements.Q95) Give some advantages of REDEFINES clause.A95)1. You can REDEFINE a Variable from one PICTURE class to another PICTURE class by using the same memorylocation.3. We can REDEFINE a Single Variable into so many sub variables. (This facility is very useful in solvingY2000Problem.)Q96) What is the difference between static call & Dynamic callA96) In the case of Static call, the called program is a stand-alone program, it is an executable program. During run time we can call it in our called program. As about Dynamic call, the called program is not an executable program it can executed through the called programQ97) What do you feel makes a good program?A97) A program that follows a top down approach. It is also one that other programmers or users can follow logically and is easy to read and understand.Q98) How do you code Cobol to access a parameter that has been defined in JCL? And do you code the PARMparameter on the EXEC line in JCL?A98)1) using JCL with sysin. //sysin dd *here u code the parameters(value) to pass in to cobol program /* and in programyou use accept variable name(one accept will read one row)/.another way.2) in jcl using parm statement ex: in exec statement parm='john','david' in cobol pgm u have to code linkage section in that for first value you code length variable and variable name say, abc pic x(4).it will take john inside to read next value u have to code another variable in the same way above mentioned.Q99) Why do we code S9(4) comp. Inspite of knowing comp-3 will occupy less space.A99) Here s9(4)comp is small integer ,so two words equal to 1 byte so totally it will occupy 2 bytes(4 words).here in s9(4) comp-3 as one word is equal to 1/2 byte.4 words equal to 2 bytes and sign will occupy 1/2 byte so totally it will occupy 3 bytes.Q100) The maximum number of dimensions that an array can have in COBOL-85 is ----------- ?A100) SEVEN in COBOL - 85 and THREE in COBOL - 84Q101) How do you declare a host variable (in COBOL) for an attribute named Emp-Name of type VARCHAR(25) ?A101)01 EMP-GRP.49 E-LEN PIC S9(4) COMP.49 E-NAME PIC X(25).Q102) What is Comm?A102) COMM - HALF WORD BINARYQ103) Differentiate COBOL and COBOL-II. (Most of our programs are written in COBOLII, so, it is good to know,how, this is different from COBOL)A103) The following features are available with VS COBOL II:1. MVS/XA and MVS/ESA support The compiler and the object programs it produces can be run in either24- or 31-bit addressing mode.。

COBOL试题答案

COBOL试题答案

一、选择题(15分)(含多项选择)1、不属于COBOL程序的部的是:(B )A.过程部。

B.程序部。

C.数据部D.环境部2、COBOL程序中的数据在哪个部中定义?(C )A.过程部。

B.环境部。

C.数据部D.标识部3、COBOL程序中如果有环境部的话,应置于:(C )A.过程部之后标识部之前。

B.标识部之后过程部之前。

C.标识部之后数据部之前。

D.数据部之后过程部之前。

4、标识部中不可缺少的段名是:(A )A.PROGRAM-IDB.AUTHORC.FILE SECTIOND.PROGRAM5、COBOL程序中一般变量在哪里定义?(D )A.标识部B.环境部C.数据部的FILE SECTIOND.数据部的WORKING-STORAGE SECTION6、下列关于过程部的说法正确的是:(C )A.过程部中可以不定义节但是必须定义段B.过程部中可以不定义段但是必须定义节C.过程部中可以不定义节和段,节和段是根据需要定义的D.所有程序都是在过程部中以STOP RUN来结束的7、下面是COBOL合法数据名的是:(ABD )A.W ANGB.TAN-1C.12345D.END-OFE.PROGRAMF.GROSS-$G.SECTION8、关系运算符的优先顺序正确的是(A )A.NOT > AND > ORB.OR> NOT > ANDC.AND > NOT > ORD.NOT > OR > AND9、下记语句表示A/B=>C的是(B )A.DIV A INTO B GIVING C.B.DIV A BY B GIVING C10、下记哪些方法可以显示出‘ABCD’六个字符(A,C )A. PIC X(6) VALUE "'ABCD'". 说明:V ALUE后依次为空格双引号单引号ABCD单引号双引号B. PIC X(6) V ALUE ''ABCD''.说明:V ALUE后依次为空格单引号单引号ABCD单引号单引号C. QUOTE ’ABCD’ QUOTE11、COBOL对文件的操作以为单位的(B )A.整个文件B.记录C.字段12、PIC 9(3) COMP-3在内存中占几BYTE?(A )A、2BYTEB、3BYTEC、6BYTE二、判断题(10分)1、在写COBOL程序时,数据名称可以随意写,只要合乎语法就行。

COBOL 练习

COBOL 练习

1.COBOL的英文缩写和中文含义。

2.COBOL语言的特点。

3.COBOL程序的编译4.COBOL程序由四个部组成,分别为。

5.标准COBOL程序每行列,被分为五个区域第1-6列为“”,第列为“续行区”,第列为“A区”,第12-72列为“”,第73-80列为“”。

6.COBOL中的相当于其它语言中的变量名,它代表一个具体的数据项。

其长度不能超过个字符。

7.分析下列数据项的值。

DISPLAY 'HELLO'. 结果为DISPLAY QUOTE 'HELLO' QUOTE. 结果为8.分析下列记录的层次。

9.部名、节名、段名、层指示符、层号、必须从A区开始书写。

层号02 ~ 49、66、88 可以从A区开始,也可以从B区开始书写。

程序的其余部分必须从B区开始书写。

10.专用层号(Special Level Number)66:77:88:11.********************** ID NAME SCORE *********************** 001 TONYD 98 ** 002 SENNE 90 **********************12.例1:77 A PIC 9(3)V9(2) VALUE 100.01.77 B PIC 9(3)V9(2) VALUE 85.71.ADD A, B TO CC=A+B+C77 C PIC 9(3)V9(2) VALUE 1.02.输出C值:186.7477 C PIC 9(3) VALUE 1.输出C值:18777 C PIC 9(3)V9 VALUE 1.0.输出C值:186.777 C PIC 9(2)V9 VALUE 1.0.输出C值:86.7例2:77 A PIC 9V9 VALUE 1.277 B PIC 9V9 VALUE 9.077 C PIC 9V9 //实际值应该是10.8 MULTIPLY A BY B GIVING C //08例3:77 A PIC 9 VALUE 477 B PIC 9 VALUE 777 C PIC 9 VALUE 877 D PIC 99 VALUE 10ADD A, B GIVING C, D ON SIZE ERROR DISPLAY C //8DISPLAY D //11GO TO S-END.例4:77 A PIC 9V9 VALUE 4.577 B PIC 9V9 VALUE 577 C PIC 9 VALUE 6ADD A, B GIVING CADD A, B GIVING C ROUNDEDADD A, B GIVING C ROUNDED ON SIZE ERROR ……例5:77 A PIC 9V9 VALUE 6.077 B PIC 99V9 VALUE 16.377 C PIC 9.9977 D PIC 9.99DIVIDE A INTO B GIVING C REMAINER DDISPLAY C //2.71DISPLAY D //0.04例6:77 A PIC 9V9 VALUE 6.077 B PIC 99V9 VALUE 16.377 E PIC 9.977 F PIC 9.9DIVIDE A INTO B GIVING E REMAINER FDISPLAY E //2.7DISPLAY F //0.1例7:77 A PIC 9V9 VALUE 6.077 B PIC 99V9 VALUE 16.377 C PIC 9.9977 D PIC 9.99DIVIDE A INTO B GIVING C ROUNDED REMAINER D DISPLAY C //2.72 (2.716四舍五入)DISPLAY D //0.04例8:77 A PIC 9 VALUE 877 B PIC 9(4) VALUE 100677 C PIC 99.977 D PIC 9. 9DIVIDE A INTO B GIVING C REMAINER DON SIZE ERRORDISPLAY C //结果125.7,C溢出仍为原值DISPLAY D //0.4。

COBOL暑期课程试卷

COBOL暑期课程试卷

COBOL 试卷 ( 2009暑期课程 )一、综合填空(40分):1、传统COBOL 程序书写方式为固定格式,分为标号区、续行区、A 区、B 区和注释区,请问A 区从 第8 列开始,B 区从 第12 列开始2、从下列提供的字符串中选择出所有合法的COBOL 数据名 A BA 、123AZXB 、1-2-AC 、m_fDataD 、1234563、如果X 的值为10,Y 的值为20,Z 的值为30,经过如下表达式(不考虑溢出)以后,给出变量的值ADD X TO Y GIVING Z Z 的值为: 30DIVIDE X INTO Z Z 的值为: 3 MULTIPLY X BY Y GIVING Z Z 的值为: 2004、根据如下表达式,完成该COMPUTE 语句 X A D C B A =>+-+713106)()( COMPUTE (A + B ** 6) ** 10 / (C - D) ** 13 + A ** 7 => X5、有如下申明Y 是数值型整数数据项:77 Y PIC 99V99 VALUE 88.88. 写出执行下列语句后Y 的内容 (1) MOVE 12.34 TO Y. Y: 12.34 (2) MOVE 123 TO Y. Y: 23.00 (3) MOVE 0.123456 TO Y. Y: 00.12二、简答题(25分)1、在COBOL 程序中使用文件,必须在三个不同部位进行编码,试简述之(15分)(1)在环境部中,要有程序使用的每个文件的文件控制项目。

这个项目系列将程序中使用的文件名与COBOL 程序之外实际存在(或程序要生成)的文件相联系。

这些项目还定义文件的组织和访问方式。

(2)在数据部文件节中,要有每个文件的文件描述符(FD)项目。

这些项目系列将文件定义的COBOL 文件名与构成文件的记录定义相联系。

记录定义就是数据定义。

(3)在过程部,要放上处理文件的语句,包括OPEN 、READ 、WRITE 、REWRITE 、DLETE 、START 。

COBOL程序设计第一章复习题

COBOL程序设计第一章复习题

习题1、COBOL是一种高级程序设计语言,首先是由__________委员会在1960年提出,是_____的高级程序设计语言之一。

自从COBOL语言诞生其开发新的COBOL标准的职责由美国国家标准学会(ANSI)承担2、在过去的近50年里,____________成了事务处理领域的具有统治地位的程序设计语言。

3、在互联网上用GOOGLE搜索COBOL,然后再用百度搜索,阅读相关网页4、请谈一下您对COBOL这种古老的成功语言的看法5、简述COBOL编制的应用系统的特点6、简述COBOL语言成功的一些特点7、第七列位于什么区?8-11列是什么区?12-72列是什么区?8、简述四大部及其作用?9、尝试举出几个正确的COBOL字10、尝试设计一个COBOL程序,让其在终端显示一个“HELLO WORLD!”参考答案1、CODASYL 最早2、COBOL3、略4、略5、COBOL编制的应用系统一般拥有很长的生命周期。

这些耗资巨大编制出来的上百万行的COBOL程序也意味着对其替换同样耗资巨大,即使有新的也许效率更高更好的程序语言出现也是如此。

在美国等西方发达国家,成系列的商业程序运行10—30年是很常见的。

而软件工程告诉我们,一个系统运行的时间越久,对其替换就越困难。

COBOL编制的应用系统一般运行在商业的十分关键的领域。

例如,全世界超过95%的财政保险业务方面的程序由COBOL编制。

而该领域的程序一旦出现缺陷将带来严重的后果。

所谓2000年问题即是一个很好的例子。

COBOL编制的应用系统一般会处理大量的数据。

产生的单个文件或者数据库超过1000G字节也是常事。

6、一、COBOL是自文档的二、COBOL是简单的三、COBOL是可移植的四、COBOL程序是便于维护的7、续行A、B8、IDENTIFICATION DIVISION.指定源程序名及其他信息ENVIRONMENT DIVISION.存放环境信息,诸如文件、打印机等DA TA DIVISION.声明程序中的数据PROCEDURE DIVISION.程序执行的指令9、诸如:ABC 123XYZ X-Y-Z 等10、IDENTIFICATION DIVISION.PROGRAM-ID EX1A1.ENVIRONMENT DIVISION.DATA DIVISION.PROCEDURE DIVISION.S. DISPLAY 'HELLO WORLD!', RESULT.STOP RUN.。

cobol面试题及答案

cobol面试题及答案

cobol面试题及答案在现代信息技术的迅猛发展下,COBOL(COmmon Business-Oriented Language)作为一种面向商业应用的编程语言,仍然在许多企业和金融机构中得到广泛应用。

对于那些希望从事与COBOL相关的工作或者招聘COBOL开发人员的企业来说,面试是一个非常重要的环节。

本篇文章将介绍一些常见的COBOL面试题及其答案,帮助读者准备面试或者了解该编程语言的一些基本概念。

1. 什么是COBOL?COBOL是一种旨在处理商业数据的高级编程语言。

它于1960年代诞生,并在当时就被广泛用于大型计算机系统中。

COBOL采用英语类似的描述性语法,旨在提高可读性和可维护性。

2. COBOL的优点是什么?COBOL在商业领域中具有许多优点,包括:- 可读性高:COBOL使用自然语言类似的描述性语法,易于理解和维护。

- 跨平台兼容性:COBOL可在多个计算机平台上运行,为企业提供了更大的灵活性。

- 大规模数据处理:COBOL适用于大量数据的处理,因此被广泛应用于金融和保险等领域。

3. COBOL中的数据类型有哪些?COBOL支持以下几种数据类型:- 数字(Numeric):包括整数(整数)和浮点数(小数)。

- 字符串(Alphanumeric):用于存储文本数据。

- 日期和时间(Date and Time):用于存储日期和时间信息。

- 表(Table):用于存储多个值的集合。

4. 如何定义一个COBOL程序的入口点?在COBOL中,程序的入口点是通过IDENTIFICATION DIVISION 中的PROGRAM-ID子句来定义的。

例如:IDENTIFICATION DIVISION.PROGRAM-ID. MYPROGRAM.5. COBOL中的条件语句有哪些?COBOL中常见的条件语句包括IF语句和EVALUATE语句。

IF语句用于基于给定条件执行不同的代码块,而EVALUATE语句则用于根据不同的条件执行不同的操作。

COBOL经典面试题库

COBOL经典面试题库

我们经常用‎来复习用的‎,大多数版‎本只有英文‎,这个好像‎还是基地的‎同事们一起‎翻译出来的‎Q1)‎Name‎the ‎d ivis‎i ons ‎i n a ‎C OBOL‎prog‎r am ?‎.A1)‎IDEN‎T IFIC‎A TION‎DIVI‎S ION,‎ENVI‎R ONME‎N T DI‎V ISIO‎N, DA‎T A DI‎V ISIO‎N, PR‎O CEDU‎R E DI‎V ISIO‎N.Q:‎列举COB‎O L的DE‎V ISIO‎NA:标‎识部,环境‎部,数据部‎,过程部‎Q2) ‎W hat ‎a re t‎h e di‎f fere‎n t da‎t a ty‎p es a‎v aila‎b le i‎n COB‎O L?A‎2) Al‎p ha-n‎u meri‎c (X)‎, alp‎h abet‎i c (A‎) and‎nume‎r ic (‎9).Q‎:COBO‎L有哪些可‎用的数据类‎型A:字‎符型(这里‎指的是包含‎字母和数字‎),字母型‎,数字型‎Q3) ‎W hat ‎d oes ‎t he I‎N ITIA‎L IZE ‎v erb ‎d o? -‎GSA‎3) Al‎p habe‎t ic, ‎A lpha‎n umer‎i c fi‎e lds ‎& alp‎h anum‎e ric ‎e dite‎d ite‎m s ar‎e set‎to S‎P ACES‎. Num‎e ric,‎Nume‎r ic e‎d ited‎item‎s set‎to Z‎E RO. ‎F ILLE‎R , O‎C CURS‎DEPE‎N DING‎ONi‎t ems ‎l eft ‎u ntou‎c hed.‎Q:IN‎I TIAL‎I ZE这个‎词做了些什‎么A:将‎字母,字符‎,数字区域‎都置成空格‎(置空),‎将数字区置‎0, FI‎L LER和‎O CCUR‎S DEP‎E NDIN‎G ON项‎不处理‎Q4) W‎h at i‎s 77 ‎l evel‎used‎for ‎?A4)‎Elem‎e ntar‎y lev‎e l it‎e m. C‎a nnot‎be s‎u bdiv‎i sion‎s of ‎o ther‎item‎s (ca‎n not ‎b equ‎a lifi‎e d), ‎n or c‎a n th‎e y be‎subd‎i vide‎d the‎m selv‎e s.Q‎:77层有‎什么作用‎A:基本层‎数据项,不‎能用做细分‎别的层,也‎不能被细分‎(来源:‎h ttp:‎//www‎.newc‎o in.i‎n fo)‎Q5) ‎W hat ‎i s 88‎leve‎l use‎d for‎?A5‎) For‎cond‎i tion‎name‎s.Q:‎88层有什‎么作用A‎:条件逻辑‎层Q6‎) Wha‎t is ‎l evel‎66 u‎s ed f‎o r ?‎A6) F‎o r RE‎N AMES‎clau‎s e.Q‎:66层有‎什么作用‎A:重命名‎层Q7‎) Wha‎t doe‎s the‎IS N‎U MERI‎C cla‎u se e‎s tabl‎i sh ?‎A7) ‎I S NU‎M ERIC‎can ‎b e us‎e d on‎alph‎a nume‎r ic i‎t ems,‎sign‎e d nu‎m eric‎& pa‎c ked ‎d ecim‎a l it‎e ms a‎n d un‎s igne‎d num‎e ric ‎& pac‎k ed d‎e cima‎l ite‎m s. I‎S NUM‎E RIC ‎r etur‎n s TR‎U E if‎the ‎i tem ‎o nly ‎c onsi‎s ts o‎f 0-9‎. How‎e ver,‎if t‎h e it‎e m be‎i ng t‎e sted‎is a‎sign‎e d it‎e m, t‎h en i‎t may‎cont‎a in 0‎-9, +‎and ‎- .Q‎:IS N‎U MERI‎C这个子句‎怎么确定(‎也就是说确‎定句子的真‎值)A:‎I S NU‎M ERIC‎用在字符项‎,带符号数‎字,浮点数‎,不带符号‎数。

COBOL习题

COBOL习题

COBOL习题COBOL语言测试试卷二一、选择题(共20分)1.关于COBOL语言,正确的是()A.COBOL非常适合用于科学计算B.可以用COBOL写操作系统内核程序C.COBOL追求类自然英语,因此保留字较多D.COBOL程序非常强调数据类型2.关于COBOL程序结构,下面错误的是()A.COBOL程序一般由定义部、环境部、数据部和过程部组成B.COBOL程序的某个部下面不一定有节,但至少应该有一个段C.过程部里可以直接包含语句,而不必要有节或段D.COBOL程序也有顺序、分支和循环等结构3.下面变量名错误的是()A.-class B.class-1 C.SPACED.class1-4.下面不是COBOL保留字的是()A.IDENTIFICATIONB.ZEROC.ALLD.begin5.关于PIC语句,下面叙述不正确的是()A.普通PIC语句刻画了变量的数据类型及尺寸B.PIC语句可以通过VALUE短语给变量付初值C.PIC语句只出现在数据部中D.PIC语句不能定义数据的显示和打印格式6.关于记录缓冲器,下面说法正确的是()A.COBOL程序用到的每个输入或输出文件都必须有独立的记录缓冲器B.COBOL程序用到的每个输入或输出文件可以有多个记录缓冲器C.如果COBOL程序用到的多个输入或输出文件的记录内容和格式完全相同,则它们可以共用记录缓冲器D.COBOL程序用到的输入或输出文件可以没有记录缓冲器7.关于COBOL的顺序文件处理,正确的是()A.COBOL程序可以直接使用输入或输出文件的文件名B.COBOL程序只能通过内部文件名来使用输入或输出文件C.内部文件名和外部文件名之间的指代关系在数据部里说明D.用到输入或输出文件的COBOL程序可以没有环境部8.下面IF语句中的条件部分隐含的主体是()IF VarA>VarB AND VarC AND VarDDISPLAY“VarA is the Greatest”END-IFA.VarAB.VarBC.VarCD.VarA>9.关于Edited Picture语句,不正确的是()A.它极大地满足了我们对财务数据的格式化要求B.它不能包含A、9、X、V、S等普通符号C.它定义的变量不能参与四则运算D.它定义的变量可以接受四则运算结果10.关于Table和Group,不正确的是()A.Table实际上可以看成有多个同名子项目的GroupB.Table的元素可以是GroupC.Group的子项目可以是TableD.Group的子项目不能是Table二、填空题1.A变量的值及B变量的定义如下,在执行MOVEA TO B后,B的值各是多少?(20分)A的值B的定义B的值85PIC ZZZ.99_________________13PIC ZZZ.ZZ_________________120138PIC99/99/99_________________2.58PIC-*(3).99_________________5000PIC9(4)_________________-5000PIC9(4)C_________________1024PIC9999._________________123.5PIC-9(3).9_________________123.5PIC+9(3).9_________________2.58PIC$Z(3).99_________________2.要写一个COBOL程序从一个文件中输入客户信息,然后将每个客户信息分行输出到另一个文件中作为客户报告,其中输入的每一个客户输入记录包含以下数据:COLUMNS CONTENTS ――――――――――――――――――――――――――――――――――――1-6Customer Number(5digits plus1letter)7-26Customer Name27-46Street Address47-61City62-63Z-letter State Addreviation64-73Zip code(fromat:99999-9999)74-77Year of last purchase78-80unused要求输出文件中的客户报告格式如下所示(每行80字符,各项之间空2格):――――――――――――――――――――――――――――――――――――JOE SCHMOE199612345S314COLLECE DRIVEDEKALB IL601115-1342KELLY ANDERSON199412354A723420TH STREETBYRON IL61113-4218ANN WILSON199721345W2345WILSHIRE BLVDCHICAGO IL61234-21345填空完成以下COBOL程序,以达到上述目的。

JCLCOBOLDB2CICSVASM考试题

JCLCOBOLDB2CICSVASM考试题

Name: _____________ Grade: ____________
1. What is the difference between the JOBLIB and the STEPLIB statements?
The position difference.joblib adapts whole job,steplib only exec.
指定到那个proc的作业步,cond(2,eq,),nullify用even
10. How do you create a temporary dataset? Where will you use them?
Dsn=&& 参数(new,pass,delete)下去的,这样就是temporary
4. What are three major types of JCL statements? What are their functions?
Job,exec,dd statements.
5. What is the difference between catalogue procedure and In-Stream procedure?
6. What are the differences between Temporary Storage Queue (TSQ) and Transient Data Queue (TDQ)?
7. what do the following transactions do?
CEDF:
2. Name some of the JCL statements that are not allowed in PROCs.

COBOL Exercise,cobol 练习题

COBOL Exercise,cobol 练习题

Data Preparation

Allocate a PS dataset named ‘tsoid.INPUT.PS’ (record format is fixed-length,record length is 10) Add records to this PS file as the following:
COBOL Exercises
Exercise 1

Code a program named ‘tsoid01’ in ‘tsoitext from SYSIN to 4 characters; judge this text is numeric or not; if it is a numeric text, then divide by 2, then display ‘result is’ quotient and ‘remainder is’ remainder; if it is not a numeric text, then display ‘it is not a correct number’ with the text
Exercise 3

Code a program named ‘tsoid03’ in ‘tsoid.TRNING.PDS’ ‘tsoid03’ is same as ‘tsoid02’, except


using a subprogram ‘tsoidS1’ to calculate the start character number in string


Acct No (10 Chars) 1 blank Customer Name (10 Chars) 1 blank Amount (18 Chars) 1 blank Operation (1 Chars)

cobol练习

cobol练习

. 用带符号的操作符‘S’定义两个变量,使两个变量为一正数,一负数,把两数相加。

显示出来。

单独显示出的数字会有乱码,相加后得0,但也有乱码。

3.定义一个组合变量,给子变量赋值,然后分别显示组合变量和子变量的值。

效果相同。

4.定义变量A,使用重定义定义变量B,C,定义一个共同变量A。

同时显示定义变量和被定义变量的值。

在变量C之前,定义一个普通变量D。

看编译结果如何。

可以看出,重定义变量B、C与A共用一块空间,对其中任何一个改变都会影响到三个的值。

重定义变量C必须紧跟原变量,中间插入另一个变量会使重定义失败。

IDENTIFICATION DIVISION.PROGRAM-ID. TEST1.AUTHOR. ERIC*ENVIRONMENT DIVISION.*DATA DIVISION.WORKING-STORAGE SECTION.01 TEST-DATA PIC X(20).01 TEST-DATA2 PIC S9(3).01 TEST-DATA3 REDEFINES TEST-DATA2 PIC X(20).01 TEST-DATA4 PIC 9(5).01 STUDENT.02 NAME PIC X(5).02 SEX PIC X(5).02 AGE PIC 9(2).*PROCEDURE DIVISION.MOVE 'HELLO WORLD' TO TEST-DATA.MOVE -234 TO TEST-DATA2.ADD 234 TO TEST-DATA2.DISPLAY TEST-DATA2.DISPLAY TEST-DATA3.MOVE 'ERIC' TO NAME.MOVE 'MAN' TO SEX.MOVE 21 TO AGE.DISPLAY STUDENT.DISPLAY NAME SEX AGE.STOP RUN.。

库卡笔试复合试题

库卡笔试复合试题

库卡笔试复合试题
库卡复合试题一:
问题描述:给定一个由小写字母组成的字符串s,请返回使得
字符串中的字母按照字母表顺序重新排列后的最小字典序字符串。

输入描述:一个字符串s,长度不超过10^5。

输出描述:重新排列后的字符串。

示例:
输入:bcdae
输出:abcde
库卡复合试题二:
问题描述:给定一个包含n个整数的数组a,数组元素之间可
能有重复。

请你找出数组中第k大的不同元素(即不计重复)。

输入描述:第一行是一个整数n,代表数组长度
(1<=n<=10^5)。

接下来一行是n个整数,代表数组a(数组元素范围为-10^9
到10^9)。

最后一行是一个整数k,代表要求的第k大的不同元素。

输出描述:第k大的不同元素。

示例:
输入:
7
5 3 2 2 3 2 1
2
输出:3
库卡复合试题三:
问题描述:给定一个正整数n,求小于等于n的所有满足以下条件的数:每一位数字的立方和等于该数本身。

例如,153是一个满足条件的数,因为1^3+5^3+3^3=153。

输入描述:一个正整数n(1<=n<=10^5)。

输出描述:满足条件的所有数,按照从小到大的顺序输出。

示例:
输入:1000
输出:1 153 370 371 407。

COBOL语言测试试卷(一)

COBOL语言测试试卷(一)

COBOL语言测试试卷(一)COBOL语言测试试卷(一)一、选择题(共10分)1、关于COBOL语言,下述描述中正确的是:()A.COBOL可以用于开发操作系统。

B.COBOL还可以用于开发编译器。

C.COBOL主要用于编写面向商业的应用程序。

D.如今比较少用COBOL开发应用程序。

2、不属于COBOL程序的部的是:()A.过程部。

B.程序部。

C.数据部D.环境部3、COBOL代码中最小的单位是:()A. DivisionB. SectionC. SentenceD. Statement4、COBOL程序中的数据在哪个部中定义?()A.过程部。

B.环境部。

C.数据部D.定义部5、COBOL程序中如果有环境部的话,应置于:()A.过程部之后定义部之前。

B.定义部之后过程部之前。

C.定义部之后数据部之前。

D.数据部之后过程部之前。

6、定义部中不可缺少的段名是:()A.PROGRAM-IDB.AUTHORC.FILE SECTIOND.PROGRAM7、COBOL程序中一般变量在哪里定义?()A.定义部B.环境部C.数据部的FILE SECTIOND.数据部的WORKING-STORAGE SECTION8、在过程部中,可以没有的是:()A.SECTIONB.PARAGRAPHC.SENTENCED.STATEMENT9、当一个COBOL编译器区分A区和B区的时候,必须从B区开始的是:()A.段名B.节名和01级数据C.部名D.过程部里的Sentences。

10、在COBOL程序中,下列用户自定义的名称有效的是:()A.This resultB.-GrosspayC.Grosspay-D.Gross-pay二、判断题(共20分)1、在写COBOL程序时,数据名称可以随意写,只要合乎语法就行。

()2、就象其它编程语言一样,COBOL允许程序员自定义常量名。

()3、COBOL程序中用到的每个变量都必须在数据部里声明。

COBOL程序题

COBOL程序题

PROGRAM-ID.EXAM1.ENVIRONMENT DIVISION. PROCEDUREDIVISION.S.DISPLAY'THIS IS COBOL PROGRAM.' STOP RUN.PROGRAM-ID.EXAM2. ENVIRONMENT DIVISION. DATA DIVISION.WORKING-STORAGESECTION. 77A PICTURE IS9(3).77B PICTURE IS9(3). PROCEDURE DIVISION.S.ACCEPT AACCEPT BADD A TO BDISPLAY A,B.STOP RUN.PROGRAM-ID.EXAM2-1. ENVIRONMENT DIVISION. DATA DIVISION.WORKING-STORAGE SECTION. 77X PIC9(4).77A PIC9(4).77B PIC9(4).77C PIC9(4).01T.02T1PIC9(4).02T2PIC9(4).02T3PIC9(4).02T4PIC9(4). PROCEDUREDIVISION.S.ACCEPT A.ACCEPT B.ACCEPT C.COMPUTE X=(A+B)/C MOVEA TO T1.MOVEB TO T2.MOVEC TO T3.MOVEX TO T4.DISPLAY T.STOP RUN.PROGRAM-ID.EXAM2-2. ENVIRONMENT DIVISION. DATA DIVISION.WORKING-STORAGE SECTION. 77N PIC99.PROCEDURE DIVISION.S.ACCEPT N.ADD3TO N.DIVIDE5INTO N. SUBTRACT2FROM N. MULTIPLY8BY N. DISPLAY N.STOP RUN.PROGRAM-ID.EXAM2-4. ENVIRONMENT DIVISION. DATA DIVISION.WORKING-STORAGE SECTION. 77X PIC9999.77A PIC99.77B PIC99.77C PIC99. PROCEDURE DIVISION.S.ACCEPT A.ACCEPT B.ACCEPT C.COMPUTE X=(A+B)/C. DISPLAY X.STOP RUN.PROGRAM-ID.EXAM2-7. ENVIRONMENT DIVISION.DATA DIVISION.WORKING-STORAGE SECTION. 77M PIC9999.77I PIC9.77AMOUNT PIC99999. PROCEDURE DIVISION.ACCEPT M.DIVIDE50INTO M GIVING I. ADD1TO I.GO TO A,B,C,D,E DEPENDING I.PUTE AMOUNT=10*M. GO TO F.PUTE AMOUNT=9*M. GO TO F.PUTE AMOUNT=8*M. GO TO F.PUTE AMOUNT=7*M. GO TO F.PUTE AMOUNT=6*M.F.DISPLAY M,AMOUNT.STOP RUN.PROGRAM-ID.EXAM2-5.ENVIRONMENT DIVISION.INPUT-OUTPUT SECTION.FILE-CONTROL.SELECT OUTPUT-FILE ASSIGN TO"C:\test.dat". DATA DIVISION.FILE SECTION.FD OUTPUT-FILE LABEL RECORD IS OMITTED. 01OUTPUT-RECORD.02FILLER PIC X.02OUT-REC PIC X(9).WORKING-STORAGE SECTION.77T PIC9999.77A PIC99.PROCEDURE DIVISION.OPEN OUTPUT OUTPUT-FILE.PERFORM4TIMESACCEPT ACOMPUTE T=(A*A)MOVE A TO OUT-RECWRITE OUTPUT-RECORD AFTER1MOVE T TO OUT-RECWRITE OUTPUT-RECORD AFTER1END-PERFORM.CLOSE OUTPUT-FILE.STOP RUN.PROGRAM-ID.EXAM2-5.ENVIRONMENT DIVISION.INPUT-OUTPUT SECTION.FILE-CONTROL.SELECT OUTPUT-FILE ASSIGN TO"C:\test.dat". DATA DIVISION.FILE SECTION.FD OUTPUT-FILE LABEL RECORD IS OMITTED. 01OUTPUT-RECORD.02FILLER PIC X.02OUT-REC PIC X(9).WORKING-STORAGE SECTION.77T PIC9999.77A PIC99.PROCEDURE DIVISION.OPEN OUTPUT OUTPUT-FILE.PERFORM4TIMESACCEPT ACOMPUTE T=(A*A)MOVE A TO OUT-RECWRITE OUTPUT-RECORD AFTER1MOVE T TO OUT-RECWRITE OUTPUT-RECORD AFTER1END-PERFORM.CLOSE OUTPUT-FILE.STOP RUN.。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

COBOL语言测试试卷(一)一、选择题(共10分)1、关于COBOL语言,下述描述中正确的是:()A.COBOL可以用于开发操作系统。

B.COBOL还可以用于开发编译器。

C.COBOL主要用于编写面向商业的应用程序。

D.如今比较少用COBOL开发应用程序。

2、不属于COBOL程序的部的是:()A.过程部。

B.程序部。

C.数据部D.环境部3、COBOL代码中最小的单位是:()A. DivisionB. SectionC. SentenceD. Statement4、COBOL程序中的数据在哪个部中定义?()A.过程部。

B.环境部。

C.数据部D.定义部5、COBOL程序中如果有环境部的话,应置于:()A.过程部之后定义部之前。

B.定义部之后过程部之前。

C.定义部之后数据部之前。

D.数据部之后过程部之前。

6、定义部中不可缺少的段名是:()A.PROGRAM-IDB.AUTHORC.FILE SECTIOND.PROGRAM7、COBOL程序中一般变量在哪里定义?()A.定义部B.环境部C.数据部的FILE SECTIOND.数据部的WORKING-STORAGE SECTION8、在过程部中,可以没有的是:()A.SECTIONB.PARAGRAPHC.SENTENCED.STATEMENT9、当一个COBOL编译器区分A区和B区的时候,必须从B区开始的是:()A.段名B.节名和01级数据C.部名D.过程部里的Sentences。

10、在COBOL程序中,下列用户自定义的名称有效的是:()A.This resultB.-GrosspayC.Grosspay-D.Gross-pay二、判断题(共20分)1、在写COBOL程序时,数据名称可以随意写,只要合乎语法就行。

()2、就象其它编程语言一样,COBOL允许程序员自定义常量名。

()3、COBOL程序中用到的每个变量都必须在数据部里声明。

()4、COBOL变量只要声明类别而不用描述长度。

()5、COBOL是严格区分数据类型的程序语言,明确了数据类型也就明确了数据格式和取值范围。

()6、“-123”和-123都是常量值,二者没有区别。

()7、象征常数指COBOL程序员自己定义的常量。

()8、ZERO、ZEROS和ZEROES具有不同的含义和作用。

()9、组数据有且仅有2级数据项目。

()10、组数据定义时下一级数据项层号必须比上一级数据项层号大1。

()12、一般认为组数据的类型是X,其长度由其所有子项决定。

()13、COBOL数据类型很简单,为变量赋值时也非常简单,无需程序员自己考虑数据格式。

()14、DISPLAY语句后的WITH NO ADVANCING子句导致回车/换行。

()15、ACCEPT只能从键盘接受输入。

()16、用COBOL开发的应用程序生存周期一般很短,维护工作量所占比重不大。

()17、COBOL程序维护仅仅指发现并修正程序中的BUG,而不包括环境和用户需求变化引起的修改。

()18、编写COBOL程序时应确保没有错误,而无需考虑将来的修改。

()19、在变量定义中使用SYNC子句导致数据存取时间减慢,但能节约存储空间。

()20、COBOL不能控制数据的存储格式,但是能控制数据的显示和打印格式。

()三、填空题(20分)1、象其它多数语言一样,COBOL程序包括顺序、_______和_______三种结构。

2、在PIC子句中,与XXXXX等价的写法是_______。

3、COBOL实现循环的动词是_______,其语法格式有多钟变体。

4、COBOL中的条件可以用简单条件、_______和条件名,而简单条件又分为_______、_______和_______ 三种。

5、在组合条件运算符中,优先级最高的是_______,居中的是_______,而最低的是_______ 。

6、定义组数据时最高级别的组数据项层号一般为_______,其它级一般数据项层号可以取_______到_______之间的任何数,而定义条件名的层号是_______。

7、当程序往下执行的可选路径超过2条时,除了可以用多个IF语句外,一般用_______实现。

8、组数据的最后一级数据一般是不可再分的,称为________数据。

9、_______子句用于定义数据显示和打印的格式,而_______子句用于定义数据的存储格式,它可以帮助我们从速度和_______上进行程序优化。

四、程序分析(30分)1、写出下列程序片段的输出。

PROCEDURE DIVISION.OUTSIDE.DISPLAY "NOW I AM AT OUTSIDE."PERFORM MIDDLE THRU INSIDE.DISPLAY "JUNMP TO OUTSIDE.".STOP RUN.MIDDLE.DISPLAY "NOW I AM AT MIDDLELINE."INSIDE.DISPLAY " NOW I AM AT INSIDE."PERFORM MIDDLE.DISPLAY " BACK TO INSIDE".2、写出下述程序的输出。

IDENTIFICATION DIVISON. PROGRAM-ID. Whereis.DATA DIVISION.01 CityCode PIC 9 VALUE 5.88 Wuhan VALUE 1.88 Beijing VALUE 2.88 Shanghai VALUE 3.88 Hongkong VALUE 4.88 mainland VALUE 1 THRU 3.PROCEDURE DIVISION.FINDME.SUBTRACT 2,1 From CityCode.IF WuhanDISPLAY "Hey, I am home."END-IFIF BeijingDISPLAY "Hey, I am in Beijing."END-IFIF ShanghaiDISPLAY "Hey, I am in Shanghai." END-IFIF mainlandDISPLAY "Hey, I am in China mainland." END-IF.EXIT PROGRAM.3、阅读以下程序:IDENTIFICATION DIVISON.PROGRAM-ID. feeder.DATA DIVISION.WORKING-STORAGE SECTION.O1 Myrice PIC 9(3) VALUE 500.PROCEDURE DEVISION.BEGIN.DISPLAY “Myrice is”,Myrice.CALL “eater” USING BY REFERENCE Myr ice.DISPLAY “Now Myrice is”,Myrice.EXIT PROGRAM.IDENTIFICATION DIVISION.PROGRAM-ID. eater.DATA DIVISON.LINKAGE SECTION.01 Rice PIC 9(3).PROCEDURE DIVISION USING Rice.EAT.SUBTRACT 100 FROM Rice.EXIT PROGRAM.END PROGRAM eater.END PROGRAM feeder.请问程序的输出是什么?如果将斜体划线部分改为CALL “eater” USING BY CONTENT Myrice.程序的输出又是什么?4、阅读以下程序片段回答问题:EVALUATE Gender TRUE TRUEWHEN "M" Age‹20 ANY MOVE 5 TO BonusWHEN "F" Age‹20 ANY MOVE 10 TO BonusWHEN "M" Age>19 AND ‹41 Service‹10 MOVE 12 TO BonusWHEN "F" Age>19 AND ‹41 Service‹10 MOVE 13 TO BonusWHEN "M" Age>40 Service‹10 MOVE 20 TO BonusWHEN "F" Age>40 Service‹10 MOVE 15 TO BonusWHEN "F" ANY Service>20 MOVE 25 TO BonusWHEN OTHER MOVE 1 TO BonusEND-EVALUATE(1)若Gender为“M”,AGE为20,Service为20,则最终Bonus应为多少? (2)若Gender为“F”,AGE为35,Service为21,则最终Bonus应为多少?5、分析以下程序片段的输出:PERFORM IterationCount VARYING Idx1 FROM 1 BY 5UNTIL Idx1 EQUAL TO 16AFTER Idx2 FROM 6 BY -2UNTIL Idx2 LESS THAN 2 DISPLAY “Idx1=”,Idx1, “Idx2=”,Idx2END PERFORM.五、程序设计(20分)1、在一个储户信息管理系统中,每个储户的信息表如下:为在内存中存放50个储户信息,请给出数据定义。

(10分)2、请写一个COBOL程序计算8的阶乘。

(10分)。

相关文档
最新文档