COBOL Interview Questions and Answers
Ques 31. Explain the purpose of the USAGE clause in COBOL.
The USAGE clause in COBOL is used to specify the internal representation of data items. It defines how data is stored in memory, such as binary, packed-decimal, or display.
Example:
01 AMOUNT PIC 9(5) USAGE COMP-3.
Ques 32. What is the significance of the MOVE CORRESPONDING statement?
The MOVE CORRESPONDING statement in COBOL is used to move corresponding data items from one record to another. It simplifies the process of copying similar fields between records.
Example:
MOVE CORRESPONDING RECORD-1 TO RECORD-2.
Ques 33. Explain the concept of the REWRITE statement in COBOL.
The REWRITE statement in COBOL is used to modify the contents of a record in a file. It is typically used in conjunction with the READ statement to update existing records.
Example:
READ FILE-1 INTO DATA-RECORD.
REWRITE DATA-RECORD.
Ques 34. What is the purpose of the SEARCH statement in COBOL?
The SEARCH statement in COBOL is used to search a table for a specified value. It is commonly used with the WHEN clause to perform conditional actions based on the search result.
Example:
SEARCH ITEM-TABLE AT END DISPLAY 'Item not found'.
Ques 35. Explain the concept of the STRING statement in COBOL.
The STRING statement in COBOL is used for string concatenation. It allows the programmer to concatenate and manipulate character strings efficiently.
Example:
STRING 'Hello' ' ' 'World' DELIMITED BY SIZE INTO OUTPUT-STRING.
Most helpful rated by users: