COBOL 面接の質問と回答
質問 26. What is the purpose of the COPY statement in COBOL?
The COPY statement in COBOL is used for including copybooks in the source code. It allows the reuse of common code and improves maintainability.
Example:
COPY 'COMMON-FILE'.
質問 27. Explain the concept of the ACCEPT statement.
The ACCEPT statement in COBOL is used for interactive input. It allows the program to receive data directly from the user during runtime.
Example:
ACCEPT EMPLOYEE-NAME.
質問 28. How does COBOL support data validation?
COBOL supports data validation through the use of conditions, the IF statement, and the EVALUATE statement. These constructs help ensure data integrity.
Example:
IF AMOUNT < 0
DISPLAY 'Invalid amount'
END-IF.
質問 29. Explain the purpose of the EXIT statement.
The EXIT statement in COBOL is used to terminate a loop prematurely. It allows the program to exit a PERFORM loop or a Section before reaching the normal end.
Example:
PERFORM UNTIL EOF-FLAG = 'Y'
...
IF SOME-CONDITION
EXIT.
END-IF.
END-PERFORM.
質問 30. What is the role of the WORKING-STORAGE section in COBOL?
The WORKING-STORAGE section in COBOL is used to declare variables that retain their values throughout the execution of the program. It provides working storage for temporary data.
Example:
WORKING-STORAGE SECTION.
01 COUNTER PIC 9(3) VALUE 0.
ユーザー評価で最も役立つ内容:
- What is COBOL?
- Explain the Division structure in COBOL.
- What is the purpose of the LEVEL number in COBOL?