What is the clause we use to access the file between two programs as a common file ?

  1. (1) Use the SYNCHRONIZED clause for the file.

  2. (2) Use the EXTERNAL clause for the file.

  3. (3) Use GLOBAL clause for the file.

  4. (4) Use COMMON clause for the file.


Correct Option: B

AI Explanation

To access a file between two programs as a common file, we use the EXTERNAL clause for the file.

Let's go through each option to understand why it is correct or incorrect:

Option A) Use the SYNCHRONIZED clause for the file. This option is incorrect because the SYNCHRONIZED clause is used to ensure that only one program can access a file at a time, preventing concurrent access.

Option B) Use the EXTERNAL clause for the file. This option is correct because the EXTERNAL clause allows multiple programs to access a file as a common file. It allows sharing of data between programs.

Option C) Use the GLOBAL clause for the file. This option is incorrect because the GLOBAL clause is used to share data between programs within the same run unit, not between different programs.

Option D) Use the COMMON clause for the file. This option is incorrect because the COMMON clause is used to define shared variables within a program, not to access a file as a common file between programs.

The correct answer is Option B) Use the EXTERNAL clause for the file. This option is correct because it allows multiple programs to access the file as a common file.

Find more quizzes: