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: 7988
Location: Bellevue, IA

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: 7988
Location: Bellevue, IA

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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm


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