Just add ";CIR" to your BUILD or FILE statement
E.g. BUILD MYLOG;REC=-80,,F,ASCII;DISC=10000;CIR
COBOL can read and write these sequentially, just as an ordinary flat file.
The FD/record description is the same as for a flat file with the same
record size.
A circular file cannot be opened simultaneously for both reading and
writing. That is, if any program has the file opened for writing, you
cannot read it. That's a bit inconvenient. You may have several
simultaneous writers if you open it with ";SHR" (or the equivalent
aoptions). For log files, you generally want to open it with the
;ACC=APPEND options (or OPEN EXTEND in COBOL).
Any program that can read a flat file should be able to read a circular file
(although POSIX programs cannot, last time I checked). You can always use
FCOPY to copy the records to a flat file and proceed from there. If you
have Suprtool, it has a program, STEXPORT, that is convenient for exporting
data to spreadsheets and PC databases.
----- Original Message -----
From: "Curt Brimacomb" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Wednesday, September 20, 2000 7:27 PM
Subject: circular files-build, read, write to
> Hello all,
>
> I want to create a circular file (message file, logfile, etc.?) that I can
> log program errors/messages into and have the file limit at 10,000. What
> would the build command look like?
>
> Is there any special way that you have to open, write, and close circular
> files using Cobol?
>
> Can you extract records from a circular file easily so that they can be
> loaded into excel, lotus, access, etc.?
>
> Any help would be appreciated.
>
> Curt Brimacomb
> Systems Manager
> Idaho Computer Services, LLC
> [log in to unmask]
> 208-734-2245 x 114
> The opinions expressed here are not mine or my employers.
>
|