WRITE and WRITE FROM in COBOL?
- Kishor Bag
- Registered Member
- Posts: 10
- Joined: Thu Jan 16, 2014 4:46 pm
WRITE and WRITE FROM in COBOL?
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?
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Re: WRITE and WRITE FROM in COBOL?
From the Manual
http://publibz.boulder.ibm.com/cgi-bin/ ... 0821081020
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.
zprogrammer
- Robert Sample
- Global Moderator
- Posts: 1900
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: WRITE and WRITE FROM in COBOL?
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.If a programmer refers to the record-area after the WRITE (not WRITE FROM), the result is unpredictable
- Kishor Bag
- Registered Member
- Posts: 10
- Joined: Thu Jan 16, 2014 4:46 pm
Re: WRITE and WRITE FROM in COBOL?
Thanks Robert. I've to get used to the terminology better.
Thanks.
Thanks.
-
- Former Team Member
- Posts: 62
- Joined: Wed Aug 07, 2013 6:43 pm
Re: WRITE and WRITE FROM in COBOL?
One of the Most Important things to do. . .I've to get used to the terminology better.
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.
Hope this helps,
d
d
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute