View previous topic :: View next topic
|
Author |
Message |
arun nehra
New User
Joined: 29 Nov 2008 Posts: 62 Location: mumbai
|
|
|
|
Hi All,
Can any one tell me whats the logic of using 'READ FILE' while reading a file while we use 'WRITE RECORD FROM' during file writting.
Regards |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
I'm not very sure about the question but most probably Manuals have the answers on READ and WRITE COBOL verbs! |
|
Back to top |
|
|
arun nehra
New User
Joined: 29 Nov 2008 Posts: 62 Location: mumbai
|
|
|
|
In simple words, why we can't go for 'WRITE FILE' (normally we go by 'WRITE RECORD' corresponding to the above file) in cobol program the same way as we go for 'READ FILE'.
I am not sure if i can get the answer to above question in the manuals. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
You READ a FILE because COBOL does not know how long the record is (in the case of variable length records) and hence you cannot specify a record name. You WRITE a RECORD because you have to tell COBOL which record (implied: the record length in the case of variable length files) to write out of all the 01 definitions in the FD. And this has been the way COBOL has been, probably back to the first compilers. |
|
Back to top |
|
|
arun nehra
New User
Joined: 29 Nov 2008 Posts: 62 Location: mumbai
|
|
|
|
Thanks Robert, That's exactly what i was looking for. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Glad to hear it helped. |
|
Back to top |
|
|
|