Global variables are accessible only to the batch program whereas external variables can be referenced from any batch program residing in the same system library.
Posted Date:- 2021-09-03 05:44:23
DB2 pre-compiler (if embedded SQL is used), CICS translator (if CICS program), Cobol compiler, Link editor. If DB2 program, create plan by binding the DBRMs.
Posted Date:- 2021-09-03 05:43:39
Move a value to RETURN-CODE register. RETURN-CODE should not be declared in your program.
Posted Date:- 2021-09-03 05:42:25
Mismatch in LRECL or BLOCKSIZE or RECFM between your COBOL pgm & the JCL (or the dataset label). You will get file status 39 on an OPEN.
Posted Date:- 2021-09-03 05:41:32
Supply the DD cards just as you would for files referred to in the main program.
Posted Date:- 2021-09-03 05:40:45
Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never have SIZE (MAX). BUFSIZE can be 2K, efficient enough.
Posted Date:- 2021-09-03 05:39:55
Causes the item to be aligned on natural boundaries. Can be SYNCHRONIZED LEFT or RIGHT.
For binary data items, the address resolution is faster if they are located at word boundaries in the memory. For example, on main frame the memory word size is 4 bytes. This means that each word will start from an address divisible by 4. If my first variable is x(3) and next one is s9(4) comp, then if you do not specify the SYNC clause, S9(4) COMP will start from 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.
Posted Date:- 2021-09-03 05:38:49
It is a special register that has the length of an elementary item or a group.
Posted Date:- 2021-09-03 05:38:15
In COBOL language, NEXT STATEMENT is used to give control to the next verb following the next period. Next Sentence is the collection of sentences that always ends with (.) so the control passes over to the next verb following the next period. When the NEXT SENTENCE is coded, 1 will not be added to input count.
CONTINUE statement is used to give control to the next verb after the explicit scope terminator. When CONTINUE is coded, +1 will be added to input count.
Posted Date:- 2021-09-03 05:37:06
In Cobol Level 66 is used for RENAMES clause and Level 88 is used for condition names.
Posted Date:- 2021-09-03 05:35:47
Must use compiler option SSRANGE if you want array bounds checking. Default is NOSSRANGE. If no options provided then it will abend with SOC4 -An Invalid address referenced due to subscript/index error.
Posted Date:- 2021-09-03 05:35:08
These are options for a compiler to find the subscript out of range.
SSRANGE is a compiler option that handles the array overflow. SSRANGE also needs to be specified in COBOL programing language. These help in finding the subscript out of range.
NOSSRANGE is used for performance sensitive applications. NOSSRANGE is a default option that doesn’t support any runtime error if the index or subscript runs out of range.
Posted Date:- 2021-09-03 05:34:10
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 call 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.
Posted Date:- 2021-09-03 05:33:31
When writing a structured COBOL program, one must follow a certain format that allows the proper implementation of the code. For instance, when constructing a case, one can use EQUIVALENT statements each time. When nesting, use scope terminators, and when you want the program to do something, try and use IN-LINE PERFORM statements. People also use TEST BEFORE and TEST AFTER statements while coding for do-while loop statements.
Posted Date:- 2021-09-03 05:32:48
Structured programming is the logical way of writing a program where functions are divided into modules and tackled logically.
Object oriented programs are those where you write the methods and functions around the Object that is identified.
COBOL is a structured and a very user friendly programming language. It is one of the oldest programming language and the functionality it provides for big administrative systems cannot be easily replaced.
Posted Date:- 2021-09-03 05:32:13
COBOL is a business-oriented application. It has many characteristics that help businesses to manage and update data. Being a business language, COBOL can handle large data volumes. Programmers can compile, execute and bring together COBOL on many machines together. It can also be used for debugging and testing tools when somebody is looking for solutions. Different versions of COBOL enhance its features manifold.
Posted Date:- 2021-09-03 05:31:34
The following errors are trapped by the ON SIZE ERROR option:
Fixed point overflow
Number zero raised to power zero
Divide by zero
Number zero raised to power negative number
A negative number raised to the power of a fraction.
Posted Date:- 2021-09-03 05:31:01
Structured programming is logical way of programming where the functionalities are divided into modules and helps write the code logically.
Object Oriented Cobol language is a Natural way of programming in which you identify the objects, and then write functions and procedures around that object.
Posted Date:- 2021-09-03 05:30:01
It is stored in the last nibble. For example if your number is +100, it stores hex 0C in the last byte, hex 1C if your 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...
Posted Date:- 2021-09-03 05:29:15
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.
Posted Date:- 2021-09-03 05:28:10
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.
Posted Date:- 2021-09-03 05:27:32
Does nothing ! If used, must be the only sentence within a paragraph.
Posted Date:- 2021-09-03 05:27:00
>> INPUT PROCEDURE- It defines the operations where input files are first opened. After opening, records are read, edited and altered. It then goes for sorting operations and finally the files are closed.
[plain]RELEASE recordname FROM inputrecord [/plain]
>> OUTPUT PROCEDURE- It defines the operations where output file is first opened and it receives the sorted record in output record. Then the file is written and finally closed.
Posted Date:- 2021-09-03 05:26:21
ON SIZE ERROR happens in situations when the result of the arithmetic operation is larger than the fixed point field. It also happens when it is divisible by 0. Other situations that result in ON SIZE ERRORS are zero raised to zero, zero raised to some negative number or a negative number raised to a fractional power.
Posted Date:- 2021-09-03 05:25:20
There are two types of linking in COBOL: static linking and dynamic linking.
In static linking, subroutine links into the calling program and doesn’t exist as a separate module.
In the dynamic module, subroutine doesn’t link into the main program and exists as a separate module. DYNAM or NODYNAM link edit options can be used for static and dynamic linking.
Posted Date:- 2021-09-03 05:24:23
S0C1 can be caused due to:
• A misspelled DD name.
• Read/Write to a dataset that is unopened.
• The subprogram called cannot be found.
• Read to the dataset for an opened output.
S0C5 can be caused due to:
• A bad or damaged Subscript/index.
• An incorrect exit from a preform.
• The I/O area is accessed before reading.
• An unopen dataset is closed.
S0C7 can be caused due to:
• A numeric operation is performed in a non-numeric data.
• Working storage is un-initialized.
• Excess coding past the max permitted dub script.
Posted Date:- 2021-09-03 05:23:31
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 paraname rather than in-line perform.
Posted Date:- 2021-09-03 05:22:46
REPLACING allows for the same copy to be repeated more than once in the same code just by replacing the value.
Posted Date:- 2021-09-03 05:22:19
Yes, COBOL is still worth learning, irrespective of the fact whether the user or programmer wants to maintain them or port them to any other programming languages. With COBOL, it could be done easily. The language is more than 60 years old, but recently, there has been a rise in demand for this due to the requirements of some government agencies. Recently programmers have been using COBOL in state government operations to handle unemployment benefits amid the pandemic.
Posted Date:- 2021-09-03 05:20:59
The modes of opening a file in COBOL are OUTPUT, INPUT, I/O and EXTEND.
What is the extreme size of a mimetic field that can be defined in COBOL?
The maximum size of a numeric field that can be defined in COBOL is PIC 9(18).
Posted Date:- 2021-09-03 05:20:33
REPLACING allows for the same copy to be used more than once in the same code by changing the replace value.
COPY <Name> REPLACING BY
Posted Date:- 2021-09-03 05:09:26
In static linking, called subroutine links into the calling program, while in dynamic linking, the subroutine & the main program will exist as separate modules. Dynamic and Static linking can be achieved by choosing either the DYNAM or NODYNAM link edit option.
Posted Date:- 2021-09-03 05:08:34
Open modes can be used for
<> Input
<> Output
<> Input – Output
<> Extend
Posted Date:- 2021-09-03 05:08:04
When you perform a SECTION, all paragraphs under the section will be performed. But if you are performing a paragraph, only the particular paragraph will be performed.
Posted Date:- 2021-09-03 05:07:25
CONTINUE is like a null statement and it continues execution, while NEXT SENTENCE transfers control to the next sentence.
Posted Date:- 2021-09-03 05:06:55
SECTION will have all the paragraphs that are part of the section, to be performed.
PARAGRAPH will have only that paragraph to be performed.
Posted Date:- 2021-09-03 05:06:27
These are the options of compile/link editing:
AMODE: Addressing Mode.
• AMODE(24): It is a 24-bit addressing mode.
• AMODE(31): It is a 31-bit addressing mode.
• AMODE(ANY): Either 24 bit or 31-bit address mode depending upon RMODE.
RMODE: Resident mode.
• RMODE(24): It resides within virtual storage below 16 Meg line.
a. Programs of 31 bit which call 24-bit programs are preferred to use this mode.
b. RMODE(ANY): Either 24 bit or 31-bit address mode depending upon RMODE.
c. OS/VS COBOL program uses 24-bit address only.
• RMODE(ANY): This mode can reside below or above 16 Meg line.
Posted Date:- 2021-09-03 05:05:52
Many times the reason for SOC7 is an un-initialized numeric item.
a. Offending data need to be corrected, focus on examining this.
b. A lot of installations provide a dump for run time abends, and these abends provide the offset which is returned by the last instruction where the abend occurred.
c. Focus on examining the compilation output XREF listing to find the verb and the line number within the source code at this offset.
d. Later investigate the source code for finding the bug.
e. Define certain datasets(SYSABOUT etc) in JCL, for capturing runtime dumps.
f. At times few installations might have batch program debugging tool. Utilize them to resolve the issue.
Posted Date:- 2021-09-03 05:05:14
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.
Posted Date:- 2021-09-03 05:04:00
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.
Posted Date:- 2021-09-03 05:03:36
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).
Posted Date:- 2021-09-03 05:02:46
In a binary search, the table element key values will be in ascending or descending sequence. The table is ‘halved'(Divided into two) 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 the elements do not have to be in a specific sequence.
The binary search is much faster for more tables, while sequential Search works well with lesser ones. SEARCH ALL is used for binary search; SEARCH for sequential search.
Posted Date:- 2021-09-03 05:02:13
There are 2 searching techniques in COBOL.
Serial search: SEARCH
• It is a process of finding a particular value in a given list.
• The search is implemented by checking each element in the list, one at a time and in sequence.
• This process is continued until the desired element is found.
• SEARCH is used for serial search.
Binary Search: SEARCH ALL
• It is a process of finding a particular element in a sorted list.
• The binary search starts by comparing the middle element of the array.
• The comparison determines the element’s location – either in the first half of the list or in the second half of the list.
• This process continues until the search element is equal to the middle element of the list
• SEARCH ALL is used for binary search.
• The list must be sorted by using the ASCENDING / DESCENDING KEY clause, which loads.
• The default key is ASCENDING KEY.
Posted Date:- 2021-09-03 05:00:43
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.
Posted Date:- 2021-09-03 04:59:14
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.
Posted Date:- 2021-09-03 04:58:41
The IS NUMERIC clause is used to check if an item is numeric or not. The value returned will be TRUE if the item that is checked for contains only numbers whether positive or negative.
Posted Date:- 2021-09-03 04:55:43
COBOL is a structured, standard programming language that can be compiled and executed on any machine. It is typically used in business applications as it can handle a large volume of data. It contains numerous debugging and testing capabilities.
Posted Date:- 2021-09-03 04:54:45
The various divisions of a COBOL program are IDENTIFICATION DIVISION, ENVIRONMENT DIVISION, DATA DIVISION and PROCEDURE DIVISION.
Posted Date:- 2021-09-03 04:52:23
There are three data types in Cobol:
1. Alpha-numeric (X)
2. Alphabetic (A) and
3. Numeric (9)
Posted Date:- 2021-09-03 04:51:36
COBOL is the abbreviation for Common Business Oriented Language. It is among the old programming languages and is primarily used in finance, business and administrative systems and applications.
Posted Date:- 2021-09-03 04:49:59