View previous topic :: View next topic
|
Author |
Message |
sivasaras
New User
Joined: 29 Sep 2007 Posts: 93 Location: chenna/i-
|
|
|
|
hi,
I have 2 input files and 1 output files.
1st files fields
01 emp.
02 name pic x(5).
02 no pic x(10).
02 filler pic x(65).
2nd file
01 emp.
02 dept pic x(5).
02 page pic x(3).
02 filler pic x(72).
now my question is i want the output is like no name age dept in a sinlge row.
How can we do that?
Regards,
Siva |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
This has got to be a homework assignment, right?
Since there's no data in common between the two files, I assume it's a straight match -- record 1 of file 1 to record 1 of file 2, record 2 of file 1 to record 2 of file 2, and so forth.
Read file 1.
Read file 2.
Move variables to output file.
Write record.
repeat until EOF. |
|
Back to top |
|
|
sivasaras
New User
Joined: 29 Sep 2007 Posts: 93 Location: chenna/i-
|
|
|
|
no it is not homework assignment? how we will do like this, because in both files different records with different field names?
can you explain the logic how we will do this?
Thanks in advance
Regards,
Siva |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
There is only one way to do it. Record 1 of file 1 is "matched" to record 1 of file 2, record 211 of file 1 is "matched" to record 211 of file 2, and so forth. If you expect anything else, either you are not telling us everything, or your expectation will not be met.
If you do not know how to read files, use the MOVE statement, and write files in COBOL, you need to be aware that there is a link to manuals at the top of this page. You need to click on it, find the COBOL Language Reference and Programming Guide manuals and read them -- cover to cover -- no matter how many hours, day, weeks, or months it takes you. Variable names are important in COBOL but they do not have any significance as far as contents -- a variable called NAME could contain numbers as well as letters. |
|
Back to top |
|
|
sivasaras
New User
Joined: 29 Sep 2007 Posts: 93 Location: chenna/i-
|
|
|
|
Thanks for thw information.
Regards,
Siva |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
It is hard to believe this is not homework. A professionally implemented system would not have this to deal with. . . Or there is some reason that we just don't know about.
d |
|
Back to top |
|
|
|