Raj, if your select looks like
SELECT OPTIONAL FILE-A ASSIGN TO FILEA
then there will be two cases:
1) FILEA DD name is not present in the JCL. The OPTIONAL clause will keep COBOL from recognizing this as an error.
Note that this is referring to the DD name, NOT THE DATA SET NAME.2) FILEA DD name is present in the JCL. The data set will be opened by COBOL and processed normally.
In no circumstances can you submit JCL that references a data set that does not exist and have the JCL ignore that file. If you reference a data set in your JCL, and you are indicating that the file already exists (DISP=MOD or DISP=SHR or DISP=OLD) then that data set must exist when the job goes through converter/interpreter processing or you
will get a JCL error. The SELECT OPTIONAL clause in COBOL is not designed to prevent JCL errors, it is designed to allow a program to run to normal completion whether or not a given DD statement is present in the JCL.