MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SELECT OPTIONAL clause in FILE CONTROL SECTION

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Thu Jul 07, 2005 12:02 am    Post subject: SELECT OPTIONAL clause in FILE CONTROL SECTION Reply with quote

Hi,

I was going through one of our programs and saw the OPTIONAL clause in the file control section. I browsed a couple of COBOL manuals and this is what they had to say.

Code:
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 defining them with the SELECT OPTIONAL phrase in the FILE-CONTROL
paragraph of your program.

It was mentioned that if a file does'nt exist, then it will be created with system defined attributes. Now is it similar to having a DUMMY dataset assigned to the file in the JCL ?

Also could you please let me know what is the use of defining files as OPTIONAL ?

Thanks,
Ram
Whatever you do in this life, it echoes in eternity !
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Thu Jul 07, 2005 6:29 am    Post subject: Reply with quote

Quote:

Now is it similar to having a DUMMY dataset assigned to the file in the JCL ?


Ram,
Nope. Optional files are created each time the program runs. Basically these files are used as temporary files. For ex: if you are doing an internal sort and you want to store the intermediate results of the sort , then you can use an optional file. It will be created and deleted at the end of the job.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Ram
Beginner


Joined: 12 Jan 2004
Posts: 53
Topics: 12

PostPosted: Fri Jul 08, 2005 4:14 am    Post subject: Reply with quote

Kolusu,

Thank you for the prompt response. The program that I was referring to had a VSAM file defined as Optional and it did not have a corresponding dd statement in the JCL. In this case will it cause any problems if I code a DUMMY dataset against the missing ddname in the JCL? I have understood that the optional file feature is helpful for intermediate storage. But in my case I cant see it serving any purpose.

Thanks,
Ram
Back to top
View user's profile Send private message
pzmohanty
Beginner


Joined: 20 May 2004
Posts: 97
Topics: 43
Location: hyderabad, India

PostPosted: Sun Aug 13, 2006 1:46 pm    Post subject: Reply with quote

Hi Kolusu,

Continuing with OPTIONAL option of SELECT clause, we can have OPTIONAL clause if a file is opened in INPUT / I-O / EXTEND mode and at the run time file gets created and also get deleted by end of program.
I am just curious to know why OPTIONAL option is not allowed with OUTPUT mode whereas it is allowed with I-O & EXTEND mode. What difference does it make.

Thanks in advance
_________________
Priya Ranjan Mohanty
Consultant
Kanbay Software (I) pvt. Ltd.
Hyderabad
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12369
Topics: 75
Location: San Jose

PostPosted: Sun Aug 13, 2006 7:29 pm    Post subject: Reply with quote

Quote:

I am just curious to know why OPTIONAL option is not allowed with OUTPUT mode whereas it is allowed with I-O & EXTEND mode. What difference does it make.

pzmohanty,

You can open the file in OUTPUT mode provided that you have the run-time option CBLQDA turned on. CBLQDA(ON) is the setting that dynamically allocates with DISP=(NEW,DELETE,DELETE) file when an output DD name is opened but missing from the TIOT.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group