Page 1 of 1
WRITE and WRITE FROM in COBOL?
Posted: Wed Jan 22, 2014 1:12 pm
by Kishor Bag
One can get the last record if we used "WRITE FROM" from some WS variable. But when you use only WRITE, the data is no longer available to the program because the pointer to the i/o buffer has been moved. If a programmer refers to the record-area after the WRITE (not WRITE FROM), the result is unpredictable - is this understading correct about WRITE and WRITE FROM?
Re: WRITE and WRITE FROM in COBOL?
Posted: Wed Jan 22, 2014 2:12 pm
by zprogrammer
From the Manual
http://publibz.boulder.ibm.com/cgi-bin/ ... 0821081020
FROM phrase The result of the execution of the WRITE statement with the FROM identifier-1 phrase is equivalent to the execution of the following statements in the order specified:
MOVE identifier-1 TO record-name-1.
WRITE record-name-1.
The MOVE is performed according to the rules for a MOVE statement without the CORRESPONDING phrase.
Re: WRITE and WRITE FROM in COBOL?
Posted: Wed Jan 22, 2014 7:52 pm
by Robert Sample
If a programmer refers to the record-area after the WRITE (not WRITE FROM), the result is unpredictable
This understanding is wrong -- attempting to access the record-area after a WRITE or WRITE FROM will yield unpredictable results, not just after the WRITE. With WRITE FROM, you can get to the last record because it is still in WORKING-STORAGE, not the record-area.
Re: WRITE and WRITE FROM in COBOL?
Posted: Thu Jan 23, 2014 3:32 pm
by Kishor Bag
Thanks Robert. I've to get used to the terminology better.
Thanks.
Re: WRITE and WRITE FROM in COBOL?
Posted: Fri Jan 24, 2014 1:53 am
by dick scherrer
I've to get used to the terminology better.
One of the Most Important things to do. . .
Terminology is Critical for understanding and quite often it is the terminology used that causes confusion.
We will help with terminology when we can. It is quit all right to ask when noe sure.