Page 1 of 1

Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 5:22 am
by dexik
My assignment has a blank table for input buffer and an output buffer. I have a physical file and a display file. So I assume the input buffer is for physical file fields and the output buffer for the display file fields?

Re: Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 6:16 am
by dexik
Correction: I am supposed to use the same screen from a display file for both input and output buffer. I know it is not so clear what I am talking about here, but maybe somebody has an idea.

Re: Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 7:14 am
by Robert Sample
Terminology is critical in IT, where similar terms may mean very different things. One of the easily retrieved definitions for "buffer" is
2. Computer Science A device or an area of a computer that temporarily stores data that is being transferred between two machines that process data at different rates, such as a computer and a printer.
For COBOL, the definition in the Glossary of the Language Reference manual is
buffer. A portion of storage used to hold input or output data temporarily.
And since the computer is processing at nanosecond speeds while I/O devices operate at (typically) millisecond speeds, the "process data at different rates" of the first definition definitely applies!

In other words, a buffer in COBOL is:
1) associated with an FD
2) is labelled with an 01 level number
3) can have multiple 01 levels for a single FD

Hence your use of terms like "input buffer" or "output buffer" may cause you problems -- the FILE may be an input file, or output file, but the memory area is merely where the data is stored once read from the file, or stored before being written to the file. And if you attempt to reference the memory area (any data item in the FD section) while the file is closed, you're going to get an abend most likely since the buffer memory isn't allocated until the file is opened.

Are you talking about opening a file, reading data from it, displaying it to a printer, and then closing the file?

Re: Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 7:55 am
by dick scherrer
Hello,

As Robert mentions, terminology is critical.

My assignment has a blank table for input buffer and an output buffer. I have a physical file and a display file.
Who provided this "information" for you?

What is a "blank table" for buffering?

What is the difference between a "phisical file" and a "display file"?

I know it is not so clear what I am talking about here, but maybe somebody has an idea.
Once we work thru some clarification, we may be able to help. Maybe if you tell us in conversational style what you need to do (rather than in computer/cobol terms), we may get a better understanding. Over time we can work on using the correct terminology.

Re: Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 9:10 am
by dexik
Thank you! Yes, a buffer to hold the data that has been read from a physical file. I think I figured it out. There are two physical files to be read from. It reads from one file and then moves appropriate fields from the file to display file fields. It is declared as a 01 field. But then it redefines this 01 field adds two more 05 fields to hold data from the second file. Hopefully this will work. Yep, correct terminology is crucial, but this is my 3d week of studying Cobol so I'm still trying to get a hang of it.

Re: Why do you need an output buffer?

PostPosted: Sun Jun 17, 2012 9:43 am
by dick scherrer
Hello,

You will get the hang of it much more quickly and more thoroughly when you use (and understand) the proper terminology.

In COBOL buffering is nearly always handled by the internals, not your code. You do not allocate buffers in your progrm whether these are input or output files or "display" files - whatever this might be. There is no term in COBOL (that i've ever seen) named "display file".

If you insist on using terminology you have created, it will be more and more difficult to communicate with the people who know COBOL well - they will not know what you mean . . .

Re: Why do you need an output buffer?

PostPosted: Mon Jun 18, 2012 6:48 pm
by Anuj Dhawan
There had been questions on Terminology and I think we did not get enough to get going, so here is one more trial - Are you working with IBM Mainframes under z/OS using Enterprise COBOL or something else?