1⟩ What divisions, sections and paragraphs are mandatory for a COBOL program?
IDENTIFICATION DIVISION and PROGRAM-ID paragraph are mandatory for a compilation error free COBOL program.
“Cobol Interview Questions and Answers will guide us now that COBOL is one of the oldest programming languages in computer history. COBOL name is an acronym for COmmon Business-Oriented Language, defining its primary domain in business, finance, and administrative systems for companies and governments. Learn COBOL programming basic and advance concepts or get preparation of COBOL based jobs interview by our this Cobol Interview Questions and Answers Guide.”
IDENTIFICATION DIVISION and PROGRAM-ID paragraph are mandatory for a compilation error free COBOL program.
Subscript refers to the array of occurrence, where as Index represents an occurrence of a table element. An index can only modified using perform, search & set. Need to have an index for a table in order to use SEARCH and SEARCH All.
Structured programming is a Logical way of programming, you divide the functionalities into modules and code logically. OOP is a Natural way of programming; you identify the objects first, and then write functions, procedures around the objects. Sorry, this may not be an adequate answer, but they are two different programming paradigms, which is difficult to put in a sentence or two.
Redefines clause is used to allow the same storage allocation to be referenced by different data names.
SIX SECTIONS
1. FILE SECTION
2. WORKING-STORAGE SECTION
3. LOCAL-STORAGE SECTION
4. SCREEN SECTION
5. REPORT SECTION
6. LINKAGE SECTION
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.
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 CONTAINS Variable 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 i.e. JCL rec length will be max rec length in pgm + 4 Variable 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 i.e. JCL rec length will be 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 IS Printer File - Use ORGANISATION IS SEQUENTIAL. Use RECORDING MODE IS F, BLOCK CONTAINS 0. (Use RECFM=FBA in JCL DCB).
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.
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 is safest to use CONTINUE rather than NEXT SENTENCE in COBOL II.
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, and EVALUATE, SEARCH and STRING.
There are at least five differences: COBOL II supports structured programming by using in line Performs and explicit scope terminators, It introduces new 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.
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.
Make sure that link option is AMODE=31 and RMODE=ANY. Compile option should never have SIZE (MAX). BUFSIZE can be 2K, efficient enough.
Use a file //dd1 DD sysout=(*, intrdr)write your JCL to this file. Pl some on try this out.
1) Use ‘evaluate’ stmt for constructing cases.
2) Use scope terminators for nesting.
3) Use in line performs stmt for writing ‘do ‘constructions.
4) Use test before and test after in the perform stmt for writing do-while constructions.
1. You can REDEFINE a Variable from one PICTURE class to another PICTURE class by using the same memory location.
2. By REDEFINES we can INITIALISE the variable in WORKING-STORAGE Section itself.
3. We can REDEFINE a Single Variable into so many sub variables. (This facility is very useful in solving Y2000 Problem.)
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 program
Using JCL with sysin. //sysin dd *here u code the parameters (value) to pass in to Cobol program /* and in program you 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.
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.
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.