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?

Answers were Sorted based on User's Feedback



a. Can the OPTIONAL clause in COBOL only be coded for input files? b. If it is coded for files o..

Answer / kb

An OPTIONAL file is being opened as EXTEND or I-O. Optional
files are files that are not necessarily present each time
the program is run. You can define files opened in INPUT,
I-O, or EXTEND mode as optional by using the SELECT OPTIONAL
phrase in the FILE-CONTROL paragraph.

Is This Answer Correct ?    4 Yes 1 No

a. Can the OPTIONAL clause in COBOL only be coded for input files? b. If it is coded for files o..

Answer / 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

More COBOL Interview Questions

What are the different rules of SORT operation?

0 Answers  


Can anyone tell me how to handle the array beyond the limit. If we have an array or a table which can handle 5000 records but now we have to compensate 20000 records with the same array? how to handle the situation.

2 Answers  


) How do u handle errors in BMS macro

0 Answers   IBM,


can we use variable picture clause as xx.99 in cobol.

3 Answers  


what modification we need to do in jcl if we use sort in cobol? I mean whether we need to include tempary file used for sorting in assign statement?

3 Answers   TCS,






how do you reference the fixed unblock file formats from cobol programs

0 Answers  


Explain about level numbers?

3 Answers  


Suppose i have a Cobol field of 10 byte. it contains a decimal sign.How to know where is the point location?

1 Answers  


hi friends,can any one post the ibm mainframe inteqview questions for 1year exp candidate,for itc infotech interview?. have any body attended for this in the past?...

1 Answers   ITC Infotech,


If i got a job on mainframe technology, will i have a bright future?. Some people are discouraging me. Let me know, is it true? Please bring back me from the confusion.

2 Answers  


given the following piece of code: CALL SUB-PGM USING A, B, C. CALL SUB-PGM USING A, C, C. (a) Both CALL statements will always produce same result. (d) Both CALL statements may produce different result. (c) Compile-time error because SUB-PGM is a dataname. (d) Compile-time error because A, B, C are used twice.

2 Answers   TCS,


Which is not true about evaluate statement

0 Answers  


Categories