IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Regarding Files in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Mon May 24, 2010 4:52 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon May 24, 2010 5:03 pm
Reply with quote

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
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Mon May 24, 2010 5:07 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Mon May 24, 2010 5:24 pm
Reply with quote

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
View user's profile Send private message
sivasaras

New User


Joined: 29 Sep 2007
Posts: 93
Location: chenna/i-

PostPosted: Mon May 24, 2010 5:39 pm
Reply with quote

Thanks for thw information.

Regards,
Siva
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon May 24, 2010 8:47 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top