View previous topic :: View next topic |
Author |
Message |
pzmohanty Beginner
Joined: 20 May 2004 Posts: 97 Topics: 43 Location: hyderabad, India
|
Posted: Wed Aug 25, 2004 2:59 am Post subject: Opening same file in both CALLING & CALLED Program |
|
|
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 |
|
|
MikeBaker Beginner
Joined: 04 May 2004 Posts: 96 Topics: 9
|
Posted: Wed Aug 25, 2004 9:58 pm Post subject: |
|
|
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 |
|
|
pzmohanty Beginner
Joined: 20 May 2004 Posts: 97 Topics: 43 Location: hyderabad, India
|
Posted: Wed Aug 25, 2004 10:46 pm Post subject: |
|
|
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 |
|
|
blitz Beginner
Joined: 24 Dec 2002 Posts: 28 Topics: 4
|
Posted: Wed Aug 25, 2004 11:11 pm Post subject: |
|
|
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 |
|
|
MikeBaker Beginner
Joined: 04 May 2004 Posts: 96 Topics: 9
|
Posted: Thu Aug 26, 2004 12:05 am Post subject: |
|
|
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 |
|
|
MikeBaker Beginner
Joined: 04 May 2004 Posts: 96 Topics: 9
|
Posted: Thu Aug 26, 2004 4:30 pm Post subject: |
|
|
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. |
|
Back to top |
|
|
Mike Chantrey Intermediate
Joined: 10 Sep 2003 Posts: 234 Topics: 1 Location: Wansford
|
Posted: Fri Aug 27, 2004 8:45 am Post subject: |
|
|
Quote: |
or perhaps put a false name.
|
May I be the first to suggest "Bill Gates". |
|
Back to top |
|
|
Vodkasoda Beginner
Joined: 23 Jan 2004 Posts: 19 Topics: 6 Location: Dublin
|
Posted: Fri Aug 27, 2004 9:09 am Post subject: |
|
|
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 !!! |
|
Back to top |
|
|
ritam_biswas Beginner
Joined: 29 May 2004 Posts: 2 Topics: 0
|
Posted: Thu Sep 02, 2004 5:31 am Post subject: Opening same file in both CALLING & CALLED Program |
|
|
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 |
|
|
|
|