Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

what are the values may come after a write statement..

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

New User


Joined: 09 Mar 2007
Posts: 17
Location: kerala

PostPosted: Wed Mar 28, 2007 10:06 am    Post subject: what are the values may come after a write statement..
Reply with quote

i have a FD section with record name WS-RECORD ......

then after executing the statement WRITE WS-RECORD what will the values in the WS-RECORD , only spaces or is there any chance to come values other than spaces?
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Mar 28, 2007 10:17 am    Post subject:
Reply with quote

Hi There,

I think it will contain the value which u have populated in it befor writing the record in output file
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Wed Mar 28, 2007 2:06 pm    Post subject:
Reply with quote

Etka, only if it is an unblocked file and unbuffered or single buffered.

Prabe, the 01 in an FD is (similar to the Linkage Section) only a pointer to one of the output buffers containing the block being built. Old data can remain.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 962
Location: Richmond, Virginia

PostPosted: Wed Mar 28, 2007 5:24 pm    Post subject:
Reply with quote

Contents of an FD record after writing are undefined, for the reasons stated above.

Many programmers use WORKING STORAGE variables, e.g., W-PAY-RECORD, populate this, then WRITE FILENAME FROM WS-PAY-RECORD.

This guarantees your values remain, to be either accessed by your code or included in the next write.

BTW - your choice WS-RECORD in an FD is not a good name, as WS- usually means WORKING STORAGE, and the FD is not in WORKING STORAGE.
Back to top
View user's profile Send private message
prabe

New User


Joined: 09 Mar 2007
Posts: 17
Location: kerala

PostPosted: Thu Mar 29, 2007 11:57 am    Post subject: Re: what are the values may come after a write statement..
Reply with quote

2. Consider the following statements. What will be written to the Output file when the last write statement is executed.

FD Out-rec.
01 Output-record.
05 field1 pic X(4).
05 field2 pic X(7).
Procedure Division.
??
Move ?Bill? to field1.
Move ?Company? to field2.
Write Output-record.
Move ?Jim? to field1.
Write Output-record.
i have given above my full question


i tried with
Move ?Bill? to field1.
Move ?Company? to field2.
Write Output-record.
Write Output-record.
Write Output-record.
Move ?Jim? to field1.
Write Output-record.

then i got output as follows( two blank lines in between two records)

BillCompany


Jim
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Mar 30, 2007 12:09 am    Post subject:
Reply with quote

Hello,

You got whatever happened to be in the output buffer area - you will not always get "blanks".

As "Jim" was the last value moved to the output area and written, Jim is the last data written. Notice that in none of the writes after the first one was the value "Company" progagated.

As was suggested above, to retain what was previously written in the data fields, write FROM a working-storage item. You cannot count on what will be in the FD fields after a write.
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
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Write R1 and R2 to OP1 and R1 to OP2 bhaskar_kanteti DFSORT/ICETOOL 10 Fri Mar 03, 2017 11:18 am
No new posts Can you write 2 recs on SORTOUT when ... Sysaron DFSORT/ICETOOL 6 Thu Feb 23, 2017 12:07 am
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us