Re: Keeping Files Open after program termination in IBM COBOL?
From: James J. Gavan (jjgavan_at_shaw.ca)
Date: 08/28/04
- Next message: James J. Gavan: "Re: z/OS and OS/VS Cobol"
- Previous message: James J. Gavan: "Re: cobol data format!!! urgent!!!"
- In reply to: LX-i: "Re: Keeping Files Open after program termination in IBM COBOL?"
- Next in thread: Joe Zitzelberger: "Re: Keeping Files Open after program termination in IBM COBOL?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 28 Aug 2004 20:58:37 GMT
LX-i wrote:
> Michael A. Newell, WB4HUC wrote:
>
>> Hello,
>>
>> Is there any way to force a file NOT to be closed when a COBOL batch
>> program ends?
>>
>> This particular program may be called many times. The
>> first time it's called it opens a sequential output report
>> file, writes the headings and one detail line for the record that it
>> processed, then it ends via a GOBACK
>> statement.
>>
>> The next time the program is called it knows this isn't
>> the first time, so it just tries to write the output line
>> for the record it processed, but I get an error because
>> it's trying to write to a file that isn't open.
>
>
> I've never worked on an IBM mainframe, but if it knows it's been
> called before, it could do an "Open Extend" on the file, as opposed to
> "Open Output".
>
>> I need the file to stay open between invocations of
>> the program, but according to the Enterprise COBOL
>> Programming Guide, the run-time environment will
>> close any open files during a normal program termination.
>
>
> The above doesn't meet that requirement, though.
>
>
OK Michael,
Let's see. Bill has already pointed you at the manuals - that's the way
to go if you can do it. If anybody can figure this - it will be Bill -
he knows roughly what I'm doing with OO.
Firstly I looked at an old M/F DOS example with an external filename -
called a program to write a series of records and then called another
program to read those records without any intervening CLOSE and re-OPEN.
Without studying it not sure how it achieved that . Certainly the STOP
RUN on exiting the demo program would automatically CLOSE any files.
IBM-wise Bill, could he do anything calling a File program with entry
-points ? I'm thinking of OO where I have a separate class for a File
which is invoked as necessary. In theory any class could open it. (I've
recently added a flag FileOpened/FileNotOpened, which of course allows
you to check that you don't do a 'double' OPEN or CLOSE.). Even when I
quit the Business Class that is using the File Class the file doesn't
automatically get CLOSEd - I specifically have to invoke it to do that.
Quitting the Master Menu jumps you to a STOP RUN which would CLOSE
anything outstanding..
Now following on Michael's thoughts. He wants to pick up on this OPENed
file in many spots in the batch processing. Assuming the entry-point
technique would work, if it is the batch start program that does the
opening/closing then can it treat the File as a sub-program via
entry-points and can intermediary programs also access through those
same entry-points, without clobbering the file when the intermediaries
come to EXIT PROGRAM ?
If Michael had the OO module for Enterprise - he might have a neat solution.
Jimmy, Calgary AB
- Next message: James J. Gavan: "Re: z/OS and OS/VS Cobol"
- Previous message: James J. Gavan: "Re: cobol data format!!! urgent!!!"
- In reply to: LX-i: "Re: Keeping Files Open after program termination in IBM COBOL?"
- Next in thread: Joe Zitzelberger: "Re: Keeping Files Open after program termination in IBM COBOL?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|