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 

Opening same file in both CALLING & CALLED Program

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


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

PostPosted: Wed Aug 25, 2004 2:59 am    Post subject: Opening same file in both CALLING & CALLED Program Reply with quote

Hi all,

I have a VSAM file , to read the records of this VSAM file I am using a CALLed Program (Subroutine).

The Vsam File is being opened in CALLed program (subroutine) for reading & is not Closed until specified by CALLing Program.

keeping in mind the above scenarios , can I open the same file for I-O in the CALLing program with different DDNAME in SELECT.....ASSIGN clause.

Thanx in advn
P.R.Mohanty
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
MikeBaker
Beginner


Joined: 04 May 2004
Posts: 96
Topics: 9

PostPosted: Wed Aug 25, 2004 9:58 pm    Post subject: Reply with quote

Assuming that you are using COBOL, then have a look at the "EXTERNAL" clause for Files/Layouts in the manual. This lets you do what you want using the same DDNAME.
Back to top
View user's profile Send private message
pzmohanty
Beginner


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

PostPosted: Wed Aug 25, 2004 10:46 pm    Post subject: Reply with quote

hi mike,

thanx 4 reply...............
but I think I failed to make the picture clearer.

first thing i want to make clear is that ,i am talking about COBOL program.

the CALLed program is already existing & I cannot make changes to it & in the called program FILE is not defined with EXTERNAL clause in FD Section.

Keeping this things in mind can i open the same file with different DDNAME in SELECT ..... ASSIGN clause of CALLing program & REWRITE in the CALLing program.

Thanx in advn
P.R.Mohanty
_________________
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
blitz
Beginner


Joined: 24 Dec 2002
Posts: 28
Topics: 4

PostPosted: Wed Aug 25, 2004 11:11 pm    Post subject: Reply with quote

I think what you are trying to ask is that whether the same file can be opened in two different modes using different dd-names in a single program ???
Back to top
View user's profile Send private message
MikeBaker
Beginner


Joined: 04 May 2004
Posts: 96
Topics: 9

PostPosted: Thu Aug 26, 2004 12:05 am    Post subject: Reply with quote

Even if you could do that (don't know, haven't tried), you will at least get a VSAM return code of '41'. Open attempted on a file already open. If you check for that in your program, plus whatever other special codes might crop up, then maybe it could be done.
Back to top
View user's profile Send private message
MikeBaker
Beginner


Joined: 04 May 2004
Posts: 96
Topics: 9

PostPosted: Thu Aug 26, 2004 4:30 pm    Post subject: Reply with quote

One last thought about this... even if it could be done by handling the special VSAM returns codes that crop up, this would be a good example of Bad Design. More experienced people would come along later and shake their head when they see what you have done. So, if you do want to do it this way, I would keep yourself anonymous, and don't put your name anywhere, or perhaps put a false name. Wink
Back to top
View user's profile Send private message
Mike Chantrey
Intermediate


Joined: 10 Sep 2003
Posts: 234
Topics: 1
Location: Wansford

PostPosted: Fri Aug 27, 2004 8:45 am    Post subject: Reply with quote

Quote:

or perhaps put a false name.


May I be the first to suggest "Bill Gates". Mr. Green
Back to top
View user's profile Send private message
Vodkasoda
Beginner


Joined: 23 Jan 2004
Posts: 19
Topics: 6
Location: Dublin

PostPosted: Fri Aug 27, 2004 9:09 am    Post subject: Reply with quote

Quote:

the CALLed program is already existing & I cannot make changes to it & in the called program FILE is not defined with EXTERNAL clause in FD Section.

Keeping this things in mind can i open the same file with different DDNAME in SELECT ..... ASSIGN clause of CALLing program & REWRITE in the CALLing program.


pzmohanty,

Is your system set up so that all I/O is done via this (and other) called modules ?

If this is the case I am sure that it's done for a reason and if you were to start updating files from outside of the controlled system modules, you might find a manager or, at the very least, the auditors, coming down on you very hard !!!

I may be way off the mark, but just in case Wink !!!
Back to top
View user's profile Send private message Send e-mail
ritam_biswas
Beginner


Joined: 29 May 2004
Posts: 2
Topics: 0

PostPosted: Thu Sep 02, 2004 5:31 am    Post subject: Opening same file in both CALLING & CALLED Program Reply with quote

Hi Mohanty,

The problem you have mentioned , seems a bit offline to me. because in our system we have huge programs(50000+ Lines), calling small programs around 1000+ lines because we do not have rights to update the file or else we do not want to touch some sensitive files, So we better buy Client Programs to pay for the BLAME GAME. This seems to be a standard practice in CALLED & CALLING Programs in Maintenance Projects.

Does your Cobol Calling program Transfers the control once and completes the Called program and then return the control? Or it keeps on calling the program from different paragraphs, If its the first case may be when the Cobol Program returns control, u can avoid closing the file in the called program and close it in the calling program.

But you said that you do not have rights to change the called program. God help us!!

What I would have done in your case is use a WORKFILE(Intermediate File) and write all the udates in it and later on change the VSAM File through a seperate program, because even giving a seperate DDNAME , would have caused file Locking Problems and will give Open Errors(41).
_________________
Thanks & Best Regards,
Biswas, Ritam.
Back to top
View user's profile Send private message
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