By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
Q 1. What are the different data types in COBOL? In general, there are five different data types in COBOL:
Alphabetic Numeric Alpha-numeric Sign Assumed Decimal Point
Q 2. How to define and access an array in COBOL? COBOL uses the Occures clause to define and access an array/table. To access an array/table in COBOL we can use the INDEX or SUBSCRIPT and access all the elements within it as well.
Q 3. What is the difference between index and subscript in COBOL?
Subscript Vs Index Means the number of occurrences of an array - This means the number of displacement positions of an array. Always declared in the working-storage section. - It need not be declared inside the working-storage section. It is initialized by the MOVE statement - It is initialized by the SET operator. It is comparatively slow to access - It is faster than Subscript Value is incremented using the ADD operator. - Here, the value is incremented using the MOVE operator Not necessary to declare INDEXED BY clauses. - Necessary to declare INDEXED BY and any other clauses in Index.
Q 4. What is static and dynamic linking in COBOL?
Static Linking Vs Dynamic Linking Here, all the library modules are basically copied into a final executable image. - This refers to the names of external or shared libraries that are placed on the memory. The OS places a single file on the memory containing the source code and other referencing libraries. - This lets programmers use a single copy of the executable file once the program has been loaded, but not the original file, a copy of it.
Q 5. How to find a calling program in COBOL? The COBOL CALL statement begins with the CALL keyword followed by the program name. If you want to pass value from the calling program to the called program then you have to use the keyword USING followed by variable names. CALL "SUB PROGRAM NAME" USING identifier-1, identifier-2.
Q 6. What is the difference between binary search and sequential search in COBOL?
Binary Search Vs Sequential Search In this, table element key values should be in an ascending or descending order. - In this, table element keys are not required to be in any order. The table is 'halved' or divided into two sections to search for the matching result. - The table is searched from the top to bottom in a sequence until the matching result is found. The better option for large tables, i.e. tables having more than 70 elements. - The better option for small tables, i.e. tables with less than or equal to 70 elements. SEARCH ALL syntax is used in Binary Searches - SEARCH syntax is used for sequential searches.
Q 7. What are the different rules to perform a search in COBOL? While applying the SEARCH statement:
This statement can only be applied to a Table only if it has been indexed using the INDEXED BY statement. The index must be initialized using the SET operator. This statement cannot be used for finding multiple matches. The SEARCH statement can be only used for doing a sequential or serial search of the table. If the search process reaches the end of an array, automatically the end statement will be executed.
Q 8. What is ssrange and nossrange in COBOL? In COBOL, SSRANGE is basically a compiler option which is used to handle the array overflow systematically. In the COBOL programming language, SSRANGE also needs to be specified which helps to find the exact subscript out of range.
Whereas, the NOSSRANGE is used in COBOL for very sensitive performance-based applications. The NOSSRANGE is usually the default option which does not support runtime errors if by any case the index or subscript goes out of range.
Q 9. What is the procedure division in COBOL? In COBOL, the Procedure division is used for including the logic of the program efficiently. Consisting of multiple executable statements using variables that are defined in the data division, this type of division, paragraph and section names are focused to be user-defined. In the procedure division, there must be at least one statement. The last statement used for ending the execution is either STOP RUN or EXIT PROGRAM.
Here's an example to demonstrate the procedure division: IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 WS-NAME PIC A(30). 01 WS-ID PIC 9(5) VALUE '12345'. PROCEDURE DIVISION. A000-FIRST-PARA. DISPLAY 'Hello There'. MOVE 'Ankit Satpathy' TO WS-NAME. DISPLAY "Here is my name : "WS-NAME. DISPLAY "Here's my ID : "WS-ID. STOP RUN.
Q 10. What is the difference between external and global variables in COBOL?
Global Variable vs External Variable It is a type of variable which is available throughout the program. - Also available throughout the program, it is declared but not allocated any memory space. It is applicable only when sharing data among nested programs via the ANSI85 dialect. - It is used to access globally declared data, including data declared using EXTERNAL or by other COBOL programs. This specifies that a data-name is available for every program being contained within the program that declares it. - Here, any external data item can be referenced via any program inside the run unit describing the data item.
Q 11. What is the difference between performing a SECTION and a PARAGRAPH? Here's the difference in performing a Section and a Paragraph in COBOL
Paragraph Vs Section
It is just a block of code containing one or more sentences. - This is a block of code that contains one or more paragraphs. It begins with a paragraph name and ends with the starting of the next paragraph. - It begins with a section name and ends with the starting of another section. This can be ended in another way by another section starting or by the end of the program. - It cannot be ended another way. All the paragraphs should code in AREA A. - All Sections should also code in AREA A. Syntax: Paragraph-name. - Syntax: {Section-name} SECTION.
Q 12. What is a scope terminator? A scope terminator is basically any COBOL verb that is always conditional, like, (IF and EVALUATE) or it has a conditional clause such as (COMPUTE, PERFORM, READ) matching scope terminator always. Completed by including the reserved word being terminated, it always starts with END-.
Q 13. What is the difference between continue and next sentence in COBOL?
Next Sentence Vs Continue This statement passes the control after the next implicit scope terminator; i.e. period (.) - This passes the control after the next Explicit scope terminator. For example, END-IF, END-PERFORM, etc. It gives control to the verb which follows the next period. - This gives control to the next verb after the scope terminator. This will focus on the next step after the period no matter the number of controls present. - It will focus on scope terminators and other conditions first before going into other controls.
Q 14. How do I resolve the SOC7 error? First of all, the SOC7 abend error is displayed when there is invalid data inside the comp field and the program is processing some computation on it. To start with, check the data you are passing as input because there must be some corrupt data which is the root cause of this error.
Here are some steps to solve this error:
If the method of input is a file and you do have a file-aid and input data layout, use the file-aid to segregate the data on a field level. File-aid will now highlight any of the incorrect data which is Invalid. Now that you have found the data which is invalid, fix the data issue.
Q 15. What are the differences between COBOL, VS-COBOL-II and MFCOBOL? COBOL is a generic term that's used to describe the programming language, the compilers, runtime libraries, the object code, etc.
The specific name for these compilers was the OS/VS COBOL Compiler and Library (5740-CB1). OS/VS COBOL is no longer supported by IBM (although equivalent runtime support can be accomplished through the use of Language Environment), and it only supported 16-bit addressing. It was quite cumbersome when it came to addressability, using a facility called BLL cells, and had other limitations.
VS COBOL II (5668-958) replaced OS/VS COBOL in the early to mid-eighties, and it provided 31-bit addressing as well as changing the language structure to make addressability easier through the use of pointers and other facilities. The migration was not transparent in most cases, though, and often some degree of application code modifications were required to upgrade to VS COBOL II.
VS COBOL II was replaced with COBOL for MVS & VM (5688-197), then COBOL for OS/390 & VM (5648-A25) and the current version of COBOL is called Enterprise COBOL for z/OS & OS/390 (5655-G53). Like OS/VS COBOL, VS COBOL II is no longer supported by IBM, and equivalent runtime capability is provided in Language Environment.
MFCOBOL is a generic term for the COBOL provided by MicroFocus through the use of compilers built into such products as Micro Focus Mainframe Express, Micro Focus Object COBOL Developer Suite, and Micro Focus Revolve. These products are much more than just compilers and libraries; they include a variety of development tools in addition, all packaged together. You cannot order MFCOBOL by itself.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.