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
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 |
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 |
INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?
What is the LINKAGE SECTION used in COBOL?
Without using move verb how to move one variable to another.
If I want to increase the Limit in GDG. What should I do?
how to pass 100 to s9(4) how r they inserted ?
Why do we use COMP-3 variables for computation, when we know that they are non displayable fields and require additional MOVE to numeric field before we populate it in output Reports?
How may divisions are there in JCL-COBOL?
Q:what is the difference between the variable length and fixed lenght.how it varies in the cobol.
What should be the sorting order for SEARCH ALL?
How can i write a comp-3 variable into a sequential file should i declara the field in the file description as comp- 3?
We are using the searching a table which is indexed, once the key is found, how can we get the occurance at which the key was found.
How can we find that module can be called – whether DYNAMICALLY or STATICALLY?