Why do you need an output buffer?



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Why do you need an output buffer?

Postby dexik » Sun Jun 17, 2012 5:22 am

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?
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: Why do you need an output buffer?

 

Re: Why do you need an output buffer?

Postby dexik » Sun Jun 17, 2012 6:16 am

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.
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: Why do you need an output buffer?

Postby Robert Sample » Sun Jun 17, 2012 7:14 am

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?
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: Why do you need an output buffer?

Postby dick scherrer » Sun Jun 17, 2012 7:55 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Why do you need an output buffer?

Postby dexik » Sun Jun 17, 2012 9:10 am

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.
dexik
 
Posts: 28
Joined: Tue Jun 12, 2012 4:30 am
Has thanked: 0 time
Been thanked: 0 time

Re: Why do you need an output buffer?

Postby dick scherrer » Sun Jun 17, 2012 9:43 am

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 . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: Why do you need an output buffer?

Postby Anuj Dhawan » Mon Jun 18, 2012 6:48 pm

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?
Anuj
Anuj Dhawan
 
Posts: 274
Joined: Mon Feb 25, 2008 3:53 am
Location: Mumbai, India
Has thanked: 6 times
Been thanked: 4 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post