Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8201
Location: Dubuque, Iowa, 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: 8201
Location: Dubuque, Iowa, 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
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts Split files upto certain limit based ... bubbu75 DFSORT/ICETOOL 5 Tue Nov 14, 2017 11:11 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts Copy selected columns from 2 input fi... Poha Eater DFSORT/ICETOOL 3 Thu Nov 02, 2017 3:43 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us