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
 

 

Regarding Files in cobol

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

New User


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

PostPosted: Mon May 24, 2010 4:52 pm    Post subject: Regarding Files in cobol
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon May 24, 2010 5:03 pm    Post subject:
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: 90
Location: chenna/i-

PostPosted: Mon May 24, 2010 5:07 pm    Post subject: Reply to: Regarding Files in cobol
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon May 24, 2010 5:24 pm    Post subject:
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: 90
Location: chenna/i-

PostPosted: Mon May 24, 2010 5:39 pm    Post subject: Reply to: Regarding Files in cobol
Reply with quote

Thanks for thw information.

Regards,
Siva
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: Mon May 24, 2010 8:47 pm    Post subject: Reply to: Regarding Files in cobol
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    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 GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am


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