a. Can the OPTIONAL clause in COBOL only be coded for input
files?
b. If it is coded for files opened in OUTPUT, I-O or EXTEND
mode, will it give a compilation error?
c. If there are no compilation errors and if such files are
not coded in the JCL, will the OPEN statement run fine when
these files are opened?
d. How will a WRITE statement work for the above files?
Answer Posted / sandy
OPTIONAL clause can be specified for files opened INPUT,
OUTPUT, I-O and EXTEND modes. It will not give any
compilation error.
If we do not have DD statements for such files during
execution, the following file status code would be obtained
when we open the file.
INPUT (JCL RC = 0)
------
Open statement will give file status of '05'. Open is
successfule but file is not present.
EXTEND (JCL RC = 0)
------
Open statement give file status of '96'. No DDNAME present.
I-O (JCL RC = 0)
------
Open statement give file status of '96'. No DDNAME present.
WRITE (JCL SOC4 ABEND)
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is perform what is varying?
Name the divisions, which are available in a cobol program?
what is the use of outrecord?
How do define dynamic array in cobol.
What is redefines clause in COBOL?
Can we change the password using ALTER? anyone tried and changed?
In COBOL programming, what is PERFORM? What is VARYING?
How to print 10 to 1 if the input have only 10 digit number?
For rewrite, why is it mandatory that file needs to be opened?
State the various causes of s0c1, s0c5 and s0c7.
What is cobol?
What are different data types in cobol?
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
Write a cobol program making use of the redefine clause.
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.