COBOL Interview Questions and Answers : Part 4

10/04/2009 No Comment

This article provides Mainframe Interview Questions covering COBOL Questions.

Please check them below and provide answers.

What is the difference between PERFORM ... WITH TEST AFTER and PERFORM ... WITH TEST BEFORE?
Answer : If TEST BEFORE is specified, the condition is tested at the beginning of each repeated execution of the specified PERFORM range. If TEST AFTER is specified, the condition is tested at the end of the each repeated execution of the PERFORM range. With TEST AFTER, the range is executed at least once.

How do you code an in-line PERFORM?
Answer : PERFORM ... ... END-PERFORM.

In an EVALUTE statement is the order of the WHEN clauses significant?
Answer : Yes. Evaluation of the WHEN clauses proceeds from top to bottom and their sequence can determine results.

What is the default value(s) for an INITIALIZE and what keyword allows for an override of the default.

Answer : INITIALIZE sets spaces to alphabetic and alphanumeric fields. Initialize sets Zeroes to numeric fields. FILLER, OCCURS DEPENDING ON items are left untouched. The REPLACING option can be used to override these defaults.

What is SET TO TRUE all about, anyway?

Answer : 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.)

What is LENGTH in COBOL II?

Answer : LENGTH acts like a special register to tell the length of a group or an elementary item.

What is the function of a delimiter in STRING?

Answer : A delimiter in STRING causes a sending field to be ended and another to be started.

What is the function of a delimiter in UNSTRING?

Answer : A delimiter when encountered in the sending field causes the current receiving field to be switched to the next one indicated.

How will you count the number of characters in a null-terminated string?

Answer : MOVE 0 TO char-count
INSPECT null-terminated-string TALLYING char-count FOR CHARACTERS BEFORE X"00"

Which statement will you use to move non-null characters from a null-terminated String?

Answer : UNSTRING null-terminated-string DELIMITED BY X"00" INTO target-area
COUNT IN char-count. (There are other methods, such as 1) using PERFORM 2) using SEARCH 3) using INSPECT and MOVE etc...)
Related Posts


No comments :

 

Aired | The content is copyrighted and may not be reproduced on other websites. | Copyright © 2009-2016 | All Rights Reserved 2016

Contact Us | About Us | Privacy Policy and Disclaimer