Thursday, February 16, 2012

COBOL FAQS-3

Q.      COBOL is an acronym. What does it stand for?
A         Common Business-Oriented Language.

Q.      What are the structured development aids introduced in COBOL II?
A         COBOL II offers the following options :
a.         EVALUATE : permits CASE construction.
b.         The in-line PERFORM : permits 'do’ construction.
c.         TEST BEFORE and TEST AFTER in the PERFORM statements : permit 'do                while' and 'do until' constructions.

Q.      What feature in COBOL II is Similar to features in other programming languages?
A         The most obvious are the explicit scope terminators for most processing actions. An alphabetical list indicates the variety :
end-add           end-if               end-search
end-call            end-multiply    end-start
end-compute    end-perform    end-string
end-delete        end-read          end-subtract
end-divide       end-return        end-unstring
end-evaluate    end-rewrite      end-write

The scope terminator ',' (as well as the period '.') is still available.

Q.     What are the three categories of data defined in the DATA division?
A         The three categories of data defined in DATA division are :
·                     The file section (FD) information
·                     Working storage information
·                     Linkage-section data definitions

Q.      When is using READ INTO not advisable?
A         READ INTO performs two actions : the file is read into the buffer and the record is moved to working storage. The construct assumes that the LRECL of every record is the same. When used with variable-length records, the results may be "unexpected".

Q.      What are the techniques for achieving "top-down" programming?
A         Top-down is an effort to avoid spaghetti code and is sometimes referred to as "go to less" programming. Processing is performed from beginning to the end of paragraphs. Performs rather than "go tos" are used to move through code. The PERFORM... THRU structure should be used only when THRU is to an EXIT paragraph.

Q.      What is the EVALUATE statement?
A         EVALUATE is the alternative to the nested IF statements and is used to select from a list of processing actions. WHEN is used instead of IF to determine if the action is to be taken. Like the IF statement, the WHEN statement should be coded from the most likely to the least likely occurrence. Like the nested IF, once the condition is true, control passes from evaluate statement to the next statement in the program.

Q.      What are the two most common forms of the EVALUATE statement?
A         The two most common forms of the EVALUATE statement are :
1.         EVALUATE TRUE, which allows multiple variables to be checked for a true condition. The list of options being tested must be prioritized, as the EVALUATE statement selects only the first TRUE condition per statement.
2.         EVALUATE VARIABLE-NAME checks multiple options for TRUE condition of a variable.

Q.      What does the INITIALIZE statement do?
A         The INITIALIZE statement initializes data areas to zeros and spaces.

Q.     How can you use INITIALIZE for specifying specific values?
A         INITIALIZE GROUP-ITEM REPLACING ALPHANUMERIC DATA By HIGH-VALUES.  When the REPLACING option is used, only specific type will be initialized.

Q.     What is reference modification?
A         Reference modification is the name for substring manipulations. The ‘:’ allows part of a data item to be used without defining data item in the data division.

Q.     Give two examples of how you would use reference modification?
A         1.         In a list of ZIP codes, the first three digits define a geographic area :
IF ZIP ( I : 3 ) = '100'
AREA = MANHATTAN
END - IF
2.         MOVE 'MEXICO' TO STATE ( 5 : 6 ) could change NEW JERSEY to NEW MEXICO.

Q.      What is a nested program?
A         A nested program is a program that allows coding of multiple procedure division within a single program. It is like a CALL, but it is more efficient.

Q.     What is the difference between a directly contained and an indirectly contained program in a nested program?
A         A directly contained program is in the next-lower nesting, while the indirectly contained program is more than one nesting below.

Q.      Can there be a problem using ROUNDED in a compute statement?
A         Yes. The compute rounds each intermediate result in a compute statement and not just the final result.


Q.      Name some of the advantages of COBOL II?
A         VS-COBOL II makes the operation of computer programs more efficient :
·                     It allows code to be shared.
·                     It optimizes code.
·                     It allows faster sorting.
·                     It eases program bugging and maintenance namely :
·                     Supports a debugging tool: COBTEST.
·                     Program listings provide information in a user-oriented way.
·                     Formatted dumps display status of programs and files in COBOL format, including data names and content.
·                     VS-COBOL/CICS interaction is easier to work with because of defined interfaces.

Q.      What are VS-COBOL II special features?
A         The support of 31-bit addressing permits programs to operate “above the line” and to use larger tables in larger programs. This added space allows VSAM buffers to be placed above the 16-meg line, therefore the buffer can be larger.

Q.      What options have been removed in COBOL II?
A         COBOL II does not support ISAM and BDAM access methods and clauses which are specific to them. In addition, the following have been eliminated such as :
·                     REPORTWRITER
·                     EXAMINE
·                     TRANSFORM
·                     READY TRACE and RESET TRACE
·                     REMARKS paragraph and NOTES statement
·                     The ON statement (ON 1 PERFORM ...)

Q.      What is a nested-copy statement?
A         Independent blocks of code can be copied into the main sections of a program during compilation. COBOL II allows copied code to copy other code.

Q.      What is an example of application efficiency provided by COBOL II?
A         COBOL II will allow a program to be compiled as RE-ENTRANT. A re-entrant program can be placed in a shared virtual storage area, so that one copy of program is used to satisfy all concurrent requests for the program.

Q.      What is COBTEST?
A         COBTEST is a debugging tool for examining, monitoring and controlling VS-COBOL II programs in a test environment. Programs can be debugged by using a full-screen interactive mode, as well as a line interactive or batch mode. DATA may be altered, logic may be changed and results can be viewed on-line.

Q.      How has the return code for VSAM files been changed in COBOL II?
A         The return code has been enlarged to 6 bytes and returns the VSAM return code when the FILE STATUS is not 00. The format of the expanded return code is as follows :
·                     REGISTER 15 Return Code                 PIC 9(2) COMP.
·                     FUNCTION CODE                              PIC 9(1) COMP.
·                     FEEDBACK CODE                             PIC 9(3) COMP.

Q.      What type of documentation would you recommend for a COBOL program?
A         Document code changes at the beginning of the Program. The documentation should include chronological references following the date compiled statement and should include date in a fixed position and a brief description of the change in a fixed position.

Programming techniques such as the use of copybooks, meaningful variable name, use of 88 levels and top-down code also provide informative documentation.

Q.      What is the file organization clause?
A         The file organization clause identifies logical structure of a file.

Q.      Can the logical structure of a file be changed once it has been created?
A         No.

Q.      What is file organization indexed?
A         The file organization indexed is where the position of each logical record within a file is determined by indexes created with the file and embedded in a key in each record.

Q.      What is file organization sequential?
A         The file organization sequential indicates that records are loaded into a file based on a record-to-record relationship of data sequence. Sequential is the default file organization.

Q.      What is file organization relative?
A         The position of each logical record in the file is determined by its relative record number.

No comments:

Post a Comment