Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
WRITE statement in Cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
raghavendra_p_sarvade

New User


Joined: 17 Oct 2006
Posts: 32

PostPosted: Wed Dec 16, 2009 3:50 pm    Post subject: WRITE statement in Cobol
Reply with quote

Hi,

FD WS-FILE.
01 WS-RECORD.

When I do a WRITE WS-RECORD, I expect the WS-RECORD to retain the values after the write.

But I get the WS-RECORD as initialized to spaces in my program though the file has the record with data. The file status was 0. This is a simple flat file.

Is there a reason this could happen?

Thanks,
Raghav
Back to top
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2445
Location: Netherlands, Amstelveen

PostPosted: Wed Dec 16, 2009 4:20 pm    Post subject:
Reply with quote

I vaguely remember the following scenario :

WS-RECORD is part of an internal buffer.
The physical write will occur if the buffer is filled.
Before the buffer is filled the internal buffer pointer
is updated to point to the next record in the buffer.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8201
Location: Dubuque, Iowa, USA

PostPosted: Wed Dec 16, 2009 6:22 pm    Post subject:
Reply with quote

This is the expected behavior. If you click the manuals link at the top of the page, bring up the COBOL Language Reference manual, and look at the WRITE statement syntax, you will find that
Code:
WRITE record FROM data-area
specifically does not affect the data-area fields. However, record is part of the buffers associated with the file and record data written will not be available after the WRITE statement is done. This is normal, expected, and cannot be changed by any COBOL option or facility.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us