Multiple choice technology mainframe

20.In a program if two input files are being used and one of them will be created in Predeccesor job(it's not mandatory that the file should be created).Irrespective of the file creation if the job has to be run with out abend then what is the command used in COBOL program File division.

  1. (A) SELECT (File Name) [OPTIONAL] ASSIGN (FILE)

  2. (B) SELECT (File Name) [ALTERNATE] ASSIGN (FILE)

  3. (C) SELECT (File Name) [ELECTIVE] ASSIGN (FILE)

  4. (D) SELECT (File Name) [DISCRETIONARY] ASSIGN (FILE)

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

COBOL's OPTIONAL keyword in the FILE-CONTROL paragraph allows a program to handle files that may not exist at runtime. If the file is absent, the program can continue without abending, which is essential when predecessor jobs might not create certain files.

AI explanation

In the COBOL File Division's SELECT clause, adding the OPTIONAL keyword (SELECT filename OPTIONAL ASSIGN TO file) tells the runtime that the file may or may not exist/be populated at execution time. Without OPTIONAL, if a predecessor job hasn't created the file, the program would abend on OPEN with a file-not-found condition; with OPTIONAL specified, the program can proceed (typically getting an 'at end' condition or a defined status code on OPEN/READ) instead of abending. ALTERNATE, ELECTIVE, and DISCRETIONARY are not real COBOL SELECT-clause keywords — they're invented distractors.